test(gateway): cover helper registries
This commit is contained in:
18
src/gateway/server-chat-registry.test.ts
Normal file
18
src/gateway/server-chat-registry.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { createChatRunRegistry } from "./server-chat.js";
|
||||
|
||||
describe("chat run registry", () => {
|
||||
test("queues and removes runs per session", () => {
|
||||
const registry = createChatRunRegistry();
|
||||
|
||||
registry.add("s1", { sessionKey: "main", clientRunId: "c1" });
|
||||
registry.add("s1", { sessionKey: "main", clientRunId: "c2" });
|
||||
|
||||
expect(registry.peek("s1")?.clientRunId).toBe("c1");
|
||||
expect(registry.shift("s1")?.clientRunId).toBe("c1");
|
||||
expect(registry.peek("s1")?.clientRunId).toBe("c2");
|
||||
|
||||
expect(registry.remove("s1", "c2")?.clientRunId).toBe("c2");
|
||||
expect(registry.peek("s1")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user