mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 19:10:39 +00:00
34 lines
934 B
TypeScript
34 lines
934 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveNextcloudTalkAllowlistMatch } from "./policy.js";
|
|
|
|
describe("nextcloud-talk policy", () => {
|
|
describe("resolveNextcloudTalkAllowlistMatch", () => {
|
|
it("allows wildcard", () => {
|
|
expect(
|
|
resolveNextcloudTalkAllowlistMatch({
|
|
allowFrom: ["*"],
|
|
senderId: "user-id",
|
|
}).allowed,
|
|
).toBe(true);
|
|
});
|
|
|
|
it("allows sender id match with normalization", () => {
|
|
expect(
|
|
resolveNextcloudTalkAllowlistMatch({
|
|
allowFrom: ["nc:User-Id"],
|
|
senderId: "user-id",
|
|
}),
|
|
).toEqual({ allowed: true, matchKey: "user-id", matchSource: "id" });
|
|
});
|
|
|
|
it("blocks when sender id does not match", () => {
|
|
expect(
|
|
resolveNextcloudTalkAllowlistMatch({
|
|
allowFrom: ["allowed"],
|
|
senderId: "other",
|
|
}).allowed,
|
|
).toBe(false);
|
|
});
|
|
});
|
|
});
|