oclaw/openclaw/extensions/voice-call/src/allowlist.test.ts
oliver dbbe3add6a 重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。

Made-with: Cursor
2026-04-26 08:34:33 +08:00

18 lines
915 B
TypeScript

import { describe, expect, it } from "vitest";
import { isAllowlistedCaller, normalizePhoneNumber } from "./allowlist.js";
describe("voice-call allowlist", () => {
it("normalizes phone numbers by stripping non-digits", () => {
expect(normalizePhoneNumber("+1 (415) 555-0123")).toBe("14155550123");
expect(normalizePhoneNumber(" 020-7946-0958 ")).toBe("02079460958");
expect(normalizePhoneNumber("")).toBe("");
expect(normalizePhoneNumber()).toBe("");
});
it("matches normalized allowlist entries and rejects blank callers", () => {
expect(isAllowlistedCaller("14155550123", ["+1 (415) 555-0123", " 020-7946-0958 "])).toBe(true);
expect(isAllowlistedCaller("02079460958", ["+1 (415) 555-0123", " 020-7946-0958 "])).toBe(true);
expect(isAllowlistedCaller("", ["+1 (415) 555-0123"])).toBe(false);
expect(isAllowlistedCaller("14155550123", ["", "abc"])).toBe(false);
});
});