feat: store workspace preferences and drafts locally
This commit is contained in:
@@ -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);
|
||||
});
|
||||
Reference in New Issue
Block a user