feat: harden runtime readiness and session workflow
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user