feat: store workspace preferences and drafts locally

This commit is contained in:
2026-08-04 05:28:13 +02:00
parent 6c09adc05e
commit cee4cfa63d
8 changed files with 537 additions and 21 deletions
+19
View File
@@ -0,0 +1,19 @@
import { expect, test } from "vitest";
import { http, HttpResponse } from "msw";
import { server } from "../test/msw";
import { importWorkspace } from "./workspaces";
test("uploads a workspace bundle without JSON content type", async () => {
let contentType: string | null = null;
server.use(http.post("http://localhost:8787/workspaces/import", ({ request }) => {
contentType = request.headers.get("content-type");
return HttpResponse.json({ draft: { workspace: {} } });
}));
await importWorkspace(new File(["zip"], "clinical.thoth-workspace.zip", { type: "application/zip" }));
// jsdom's FormData is not the same implementation as Node's fetch FormData,
// so it cannot expose a browser-generated boundary here. The client must leave
// that header untouched; a real browser adds multipart/form-data + boundary.
expect(contentType ?? "").not.toMatch(/application\/json/i);
});