feat: harden runtime readiness and session workflow

This commit is contained in:
User
2026-07-14 10:27:25 +02:00
parent 6d7738d538
commit 6dbf93fff9
52 changed files with 1464 additions and 169 deletions
+13 -1
View File
@@ -1,6 +1,6 @@
import { http, HttpResponse } from "msw";
import { server } from "../test/msw";
import { createSession, listSessions } from "./sessions";
import { createSession, listSessions, prewarmRuntime } from "./sessions";
import {
renameSession, setSessionGroup, archiveSession, unarchiveSession,
deleteSession, getSessionDocuments,
@@ -18,6 +18,18 @@ test("createSession POSTs only {question} and returns the id", async () => {
expect(body).toEqual({ question: "q" });
});
test.each([202, 204])("prewarmRuntime accepts a body-less %s response", async (status) => {
let called = false;
server.use(
http.post("http://localhost:8787/runtime/prewarm", () => {
called = true;
return new HttpResponse(null, { status });
}),
);
await expect(prewarmRuntime()).resolves.toBeUndefined();
expect(called).toBe(true);
});
test("listSessions GETs the array", async () => {
server.use(http.get("http://localhost:8787/sessions", () => HttpResponse.json([{ id: "s1", status: "open", question: "q", summary: null, created_at: "t", updated_at: null, author: null }])));
const rows = await listSessions();