test: assert materialized session ids are uuid

This commit is contained in:
Shakker
2026-05-12 02:08:49 +01:00
parent bb5761ab03
commit 94704b7185

View File

@@ -30,6 +30,7 @@ const emptyPluginMetadataSnapshot = vi.hoisted(() => ({
configFingerprint: "session-status-test-empty-plugin-metadata",
plugins: [],
}));
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
const createMockConfig = () => ({
session: { mainKey: "main", scope: "per-sender" },
@@ -892,8 +893,7 @@ describe("session_status tool", () => {
modelOverride: "claude-sonnet-4-6",
liveModelSwitchPending: true,
});
expect(saved.sessionId).toBeTypeOf("string");
expect(saved.sessionId.trim().length).toBeGreaterThan(0);
expect(saved.sessionId).toMatch(UUID_RE);
});
it("materializes a valid persisted session entry when the default implicit current fallback mutates model state", async () => {
@@ -918,8 +918,7 @@ describe("session_status tool", () => {
modelOverride: "claude-sonnet-4-6",
liveModelSwitchPending: true,
});
expect(saved.sessionId).toBeTypeOf("string");
expect(saved.sessionId.trim().length).toBeGreaterThan(0);
expect(saved.sessionId).toMatch(UUID_RE);
});
it("does not synthesize a current fallback for unknown non-literal session keys", async () => {