Compare commits

...

1 commit

Author SHA1 Message Date
Alexander Wang
45e3d41b75
add test 2025-01-20 14:28:02 -08:00
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();
}, 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 () => {
const d2 = new D2();
const result = await d2.compile("x -> y", { sketch: true });