feat: pin sessions to workspace revisions

This commit is contained in:
2026-08-04 05:05:20 +02:00
parent 90894176b6
commit 301db4bd85
14 changed files with 288 additions and 54 deletions
+9 -2
View File
@@ -27,9 +27,13 @@ test("the form has only a question field (no workspace/model/provider/thinking)"
expect(screen.queryByLabelText(/thinking/i)).not.toBeInTheDocument();
});
test("submitting posts only { question } and calls onCreated", async () => {
test("submitting includes browser-local migrated preferences and calls onCreated", async () => {
localStorage.clear();
let body: unknown = null;
server.use(
http.get("http://localhost:8787/settings", () => HttpResponse.json({
workspace: "default", provider: "zai", model: "glm-5.2", thinking: "low",
})),
http.post("http://localhost:8787/sessions", async ({ request }) => {
body = await request.json();
return HttpResponse.json({ id: "s1" });
@@ -40,7 +44,10 @@ test("submitting posts only { question } and calls onCreated", async () => {
await userEvent.type(await screen.findByLabelText(/question/i), "Quante vendite nel 2025?");
await userEvent.click(screen.getByRole("button", { name: /^create$/i }));
await waitFor(() => expect(body).toEqual({ question: "Quante vendite nel 2025?" }));
await waitFor(() => expect(body).toEqual({
question: "Quante vendite nel 2025?",
workspaceId: "default", provider: "zai", model: "glm-5.2", thinking: "low",
}));
await waitFor(() => expect(onCreated).toHaveBeenCalledWith("s1"));
});