Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
leowrites committed Nov 27, 2024
1 parent 2fb167f commit 91f535e
Showing 1 changed file with 85 additions and 1 deletion.
86 changes: 85 additions & 1 deletion memory-viz/src/tests/draw.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ describe("draw function", () => {
expect(svg).toMatchSnapshot();
});
it("renders an empty svg given an empty array", () => {
const objects = [];
const objects: DrawnEntity[] = [];
const output: InstanceType<typeof MemoryModel> = draw(objects, true, {
width: 100,
roughjs_config: {
Expand Down Expand Up @@ -983,4 +983,88 @@ describe("draw function", () => {
const svg: String = m.serializeSVG();
expect(svg).toMatchSnapshot();
});
it("renders a list of snapshots", () => {
const snapshots = [
[
{
type: ".frame",
name: "__main__",
id: null,
value: {
item: 1,
},
},
{
type: "str",
id: 1,
value: "hello world",
},
],
[
{
type: ".frame",
name: "__main__",
id: null,
value: {
item: 1,
},
},
{
type: "str",
id: 1,
value: "hi world",
},
],
];
const models = draw(snapshots, true, {
roughjs_config: { options: { seed: 12345 } },
});

models.forEach((model) => {
const svg = model.serializeSVG();
expect(svg).toMatchSnapshot();
});
});
it("renders a list of snapshots", () => {
const snapshots = [
[
{
type: ".frame",
name: "__main__",
id: null,
value: {
item: 1,
},
},
{
type: "str",
id: 1,
value: "hello world",
},
],
[
{
type: ".frame",
name: "__main__",
id: null,
value: {
item: 1,
},
},
{
type: "str",
id: 1,
value: "hi world",
},
],
];
const models = draw(snapshots, true, {
roughjs_config: { options: { seed: 12345 } },
});

models.forEach((model) => {
const svg = model.serializeSVG();
expect(svg).toMatchSnapshot();
});
});
});

0 comments on commit 91f535e

Please sign in to comment.