mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 00:43:18 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
18 lines
915 B
TypeScript
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);
|
|
});
|
|
});
|