Files
openclaw/extensions/whatsapp/src/approval-auth.test.ts
2026-03-30 09:04:08 +09:00

25 lines
803 B
TypeScript

import { describe, expect, it } from "vitest";
import { whatsappApprovalAuth } from "./approval-auth.js";
describe("whatsappApprovalAuth", () => {
it("authorizes direct WhatsApp recipients and ignores groups", () => {
expect(
whatsappApprovalAuth.authorizeActorAction({
cfg: { channels: { whatsapp: { allowFrom: ["+1 (555) 123-0000"] } } },
senderId: "15551230000@s.whatsapp.net",
action: "approve",
approvalKind: "exec",
}),
).toEqual({ authorized: true });
expect(
whatsappApprovalAuth.authorizeActorAction({
cfg: { channels: { whatsapp: { allowFrom: ["12345-67890@g.us"] } } },
senderId: "+15551239999",
action: "approve",
approvalKind: "exec",
}),
).toEqual({ authorized: true });
});
});