import { describe, expect, it } from "vitest"; import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "./channel-config.js"; describe("buildChannelKeyCandidates", () => { it("dedupes and trims keys", () => { expect(buildChannelKeyCandidates(" a ", "a", "", "b", "b")).toEqual(["a", "b"]); }); }); describe("resolveChannelEntryMatch", () => { it("returns matched entry and wildcard metadata", () => { const entries = { a: { allow: true }, "*": { allow: false } }; const match = resolveChannelEntryMatch({ entries, keys: ["missing", "a"], wildcardKey: "*", }); expect(match.entry).toBe(entries.a); expect(match.key).toBe("a"); expect(match.wildcardEntry).toBe(entries["*"]); expect(match.wildcardKey).toBe("*"); }); });