This commit is contained in:
Alexander Wang 2025-01-20 14:28:02 -08:00
parent ac7dd4177a
commit 45e3d41b75
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
2 changed files with 13 additions and 1 deletions

View file

@ -1 +1 @@
export * from "./platform.node.js"; export * from "./platform.node.js";

View file

@ -25,6 +25,18 @@ describe("D2 Unit Tests", () => {
await d2.worker.terminate(); await d2.worker.terminate();
}, 20000); }, 20000);
test("multiple renders works", async () => {
const d2 = new D2();
const result = await d2.compile("x -> y");
const svg = await d2.render(result.diagram);
expect(svg).toContain("<svg");
expect(svg).toContain("</svg>");
const result2 = await d2.compile("x -> y");
const svg2 = await d2.render(result2.diagram);
expect(svg).toEqual(svg2);
await d2.worker.terminate();
}, 20000);
test("sketch render works", async () => { test("sketch render works", async () => {
const d2 = new D2(); const d2 = new D2();
const result = await d2.compile("x -> y", { sketch: true }); const result = await d2.compile("x -> y", { sketch: true });