From 45e3d41b75486ccc15996def0bf445069040fe55 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 20 Jan 2025 14:28:02 -0800 Subject: [PATCH] add test --- d2js/js/src/platform.js | 2 +- d2js/js/test/unit/basic.test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/d2js/js/src/platform.js b/d2js/js/src/platform.js index 1a607e21d0..fdcbaa0518 100644 --- a/d2js/js/src/platform.js +++ b/d2js/js/src/platform.js @@ -1 +1 @@ -export * from "./platform.node.js"; +export * from "./platform.node.js"; \ No newline at end of file diff --git a/d2js/js/test/unit/basic.test.js b/d2js/js/test/unit/basic.test.js index 063c02b7ee..fb04aed6d9 100644 --- a/d2js/js/test/unit/basic.test.js +++ b/d2js/js/test/unit/basic.test.js @@ -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(""); + 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 });