add test
This commit is contained in:
parent
ac7dd4177a
commit
45e3d41b75
2 changed files with 13 additions and 1 deletions
|
|
@ -1 +1 @@
|
||||||
export * from "./platform.node.js";
|
export * from "./platform.node.js";
|
||||||
|
|
@ -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 });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue