test: use synthetic ui channel fixtures

This commit is contained in:
Peter Steinberger
2026-04-20 23:54:59 +01:00
parent 73f36b0c80
commit 871aa9d0b9
3 changed files with 38 additions and 38 deletions

View File

@@ -37,18 +37,18 @@ describe("qmd scope", () => {
it("supports rawKeyPrefix matches for agent-prefixed keys", () => {
const scope: ResolvedQmdConfig["scope"] = {
default: "allow",
rules: [{ action: "deny", match: { rawKeyPrefix: "agent:main:discord:" } }],
rules: [{ action: "deny", match: { rawKeyPrefix: "agent:main:guildchat:" } }],
};
expect(isQmdScopeAllowed(scope, "agent:main:discord:channel:c123")).toBe(false);
expect(isQmdScopeAllowed(scope, "agent:main:slack:channel:c123")).toBe(true);
expect(isQmdScopeAllowed(scope, "agent:main:guildchat:channel:c123")).toBe(false);
expect(isQmdScopeAllowed(scope, "agent:main:workspace:channel:c123")).toBe(true);
});
it("keeps legacy agent-prefixed keyPrefix rules working", () => {
const scope: ResolvedQmdConfig["scope"] = {
default: "allow",
rules: [{ action: "deny", match: { keyPrefix: "agent:main:discord:" } }],
rules: [{ action: "deny", match: { keyPrefix: "agent:main:guildchat:" } }],
};
expect(isQmdScopeAllowed(scope, "agent:main:discord:channel:c123")).toBe(false);
expect(isQmdScopeAllowed(scope, "agent:main:slack:channel:c123")).toBe(true);
expect(isQmdScopeAllowed(scope, "agent:main:guildchat:channel:c123")).toBe(false);
expect(isQmdScopeAllowed(scope, "agent:main:workspace:channel:c123")).toBe(true);
});
});