Refactor CLI and Twilio modules; add helper tests and comments

This commit is contained in:
Peter Steinberger
2025-11-25 03:11:39 +01:00
parent c71abf13a1
commit afdaa7ef98
17 changed files with 996 additions and 734 deletions

View File

@@ -0,0 +1,20 @@
import { describe, expect, it } from "vitest";
import { deriveSessionKey } from "./sessions.js";
describe("sessions", () => {
it("returns normalized per-sender key", () => {
expect(
deriveSessionKey("per-sender", { From: "whatsapp:+1555" }),
).toBe("+1555");
});
it("falls back to unknown when sender missing", () => {
expect(deriveSessionKey("per-sender", {})).toBe("unknown");
});
it("global scope returns global", () => {
expect(deriveSessionKey("global", { From: "+1" })).toBe("global");
});
});