Added a `mentionMatching.ts` utility to normalize agent mention filtering across the codebase, fixing the handling of handles containing underscores. Updated `AgentMentionPopup`, `ChatView`, and `QuickChatFAB` to use the new utility, with corresponding tests added including a new `mentionMatching.te Fusion-Task-Id: FN-3809
21 lines
691 B
TypeScript
21 lines
691 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { matchesAgentMentionFilter, normalizeMentionToken } from "../mentionMatching";
|
|
|
|
describe("mentionMatching", () => {
|
|
it("normalizes spaces and hyphens into underscores", () => {
|
|
expect(normalizeMentionToken(" John Doe-Agent ")).toBe("john_doe_agent");
|
|
});
|
|
|
|
it.each([
|
|
["John Doe", "john_d"],
|
|
["John-Doe", "john_d"],
|
|
["John Doe", "john doe"],
|
|
])("matches %s with filter %s", (agentName, filter) => {
|
|
expect(matchesAgentMentionFilter(agentName, filter)).toBe(true);
|
|
});
|
|
|
|
it("returns false when filter does not match", () => {
|
|
expect(matchesAgentMentionFilter("John Doe", "alpha")).toBe(false);
|
|
});
|
|
});
|