Files
fusion/packages/dashboard/app/components/__tests__/mentionMatching.test.ts
Fusion ef1d4c7768 feat(FN-3809): normalize mention filtering for underscore handles
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
2026-05-09 10:31:05 -07:00

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);
});
});