20260513 mindmap优化01
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
createMindmapCommandApplyEndpoint,
|
||||
executeMindmapCommandApply,
|
||||
executeMindmapCommandApplyAndRefreshProjection,
|
||||
executeMindmapDataPutAndRefreshProjection,
|
||||
isMindmapAdapterProjection,
|
||||
requestMindmapAdapterProjection,
|
||||
} from "./leptos-mindmap-adapter";
|
||||
@@ -87,6 +88,23 @@ describe("leptos-mindmap adapter projection", () => {
|
||||
commands: [{ type: "deleteNode", mindmapId: "mind_1", nodeId: "node_1" }],
|
||||
fetcher,
|
||||
}),
|
||||
).rejects.toMatchObject({ code: "command_failed", status: 409 });
|
||||
).rejects.toMatchObject({ code: "command_failed", status: 409, message: "command_failed:409:revision_conflict" });
|
||||
});
|
||||
|
||||
it("data put 失败时透出 route 错误细节", async () => {
|
||||
const fetcher = vi.fn(async () => ({
|
||||
ok: false,
|
||||
status: 400,
|
||||
json: async () => ({ error: "mindmap_put_failed", details: ["missing_root_uid"] }),
|
||||
})) as unknown as typeof fetch;
|
||||
|
||||
await expect(
|
||||
executeMindmapDataPutAndRefreshProjection({
|
||||
documentId: "doc_1",
|
||||
mindmapId: "mind_1",
|
||||
data: { data: { text: "中心主题" }, children: [] },
|
||||
fetcher,
|
||||
}),
|
||||
).rejects.toMatchObject({ code: "command_failed", status: 400, message: "command_failed:400:mindmap_put_failed" });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user