Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Jan 20, 2025
1 parent ac7dd41 commit 45e3d41
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion d2js/js/src/platform.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./platform.node.js";
export * from "./platform.node.js";
12 changes: 12 additions & 0 deletions d2js/js/test/unit/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 45e3d41

Please sign in to comment.