test(cli): cover clear alias collision

This commit is contained in:
can1357
2026-07-17 04:23:23 +02:00
parent bcca907e59
commit 7b693f3d0b
2 changed files with 14 additions and 4 deletions
@@ -1,10 +1,19 @@
import { describe, expect, it } from "bun:test";
import { BUILTIN_SLASH_COMMANDS } from "@oh-my-pi/pi-coding-agent/slash-commands/builtin-registry";
import {
BUILTIN_SLASH_COMMANDS,
lookupBuiltinSlashCommand,
} from "@oh-my-pi/pi-coding-agent/slash-commands/builtin-registry";
import { CombinedAutocompleteProvider } from "@oh-my-pi/pi-tui/autocomplete";
describe("/clear slash command alias", () => {
it("ranks the new-session action above fuzzy description matches", async () => {
const provider = new CombinedAutocompleteProvider([...BUILTIN_SLASH_COMMANDS], process.cwd());
const provider = new CombinedAutocompleteProvider(
[
...BUILTIN_SLASH_COMMANDS,
{ name: "autoresearch", description: "Clear stale research results" },
],
process.cwd(),
);
const suggestions = await provider.getSuggestions(["/clear"], 0, 6);
@@ -12,5 +21,6 @@ describe("/clear slash command alias", () => {
value: "clear",
description: "Start a new session",
});
expect(lookupBuiltinSlashCommand("clear")?.name).toBe("new");
});
});