@@ -59,4 +59,31 @@ describe("prefixFilter", () => {
5959 ]);
6060 expect(prefixFilter(rich, "\x1b[31m")).toEqual([]);
6161 });
62+
63+ test("matches word prefix in filterText", () => {
64+ const models = normalizeItems([
65+ {
66+ label: "Claude Sonnet 4",
67+ value: "anthropic/claude-sonnet-4",
68+ filterText: "anthropic/claude-sonnet-4 Claude Sonnet 4 anthropic",
69+ },
70+ {
71+ label: "GPT-4o",
72+ value: "openai/gpt-4o",
73+ filterText: "openai/gpt-4o GPT-4o openai",
74+ },
75+ ]);
76+ // "cl" matches "claude-sonnet-4" and "Claude" words
77+ expect(prefixFilter(models, "cl").map((i) => i.value)).toEqual([
78+ "anthropic/claude-sonnet-4",
79+ ]);
80+ // "Son" matches "Sonnet" word
81+ expect(prefixFilter(models, "Son").map((i) => i.value)).toEqual([
82+ "anthropic/claude-sonnet-4",
83+ ]);
84+ // "gpt" matches "gpt-4o" word
85+ expect(prefixFilter(models, "gpt").map((i) => i.value)).toEqual([
86+ "openai/gpt-4o",
87+ ]);
88+ });
6289 });