- Prefix unused test variables with underscore - Remove unused piSpec import and idleMs class member - Fix import ordering and code formatting
26 lines
702 B
TypeScript
26 lines
702 B
TypeScript
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");
|
|
});
|
|
|
|
it("keeps group chats distinct", () => {
|
|
expect(deriveSessionKey("per-sender", { From: "12345-678@g.us" })).toBe(
|
|
"group:12345-678@g.us",
|
|
);
|
|
});
|
|
});
|