Skip to content

Commit

Permalink
add tests for long strings
Browse files Browse the repository at this point in the history
  • Loading branch information
leowrites committed Oct 17, 2024
1 parent 22ae8e2 commit 889c57f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions memory-viz/src/tests/draw.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -907,4 +907,44 @@ describe("draw function", () => {
})
).toThrow(errorMessage);
});

it("renders an appropriately sized box for a very long string", () => {
const objects: DrawnEntity[] = [
{
id: 1,
type: "str",
value: "I am a very very very very very very very very very very very very very very very very very very very very very very very very very very very long string",
},
];
const output: InstanceType<typeof MemoryModel> = draw(objects, true, {
width: 100,
roughjs_config: {
options: {
seed: 12345,
},
},
});
const svg: string = output.serializeSVG();
expect(svg).toMatchSnapshot();
});
it("renders an appropriately sized box for a string with the highlight style", () => {
const objects: DrawnEntity[] = [
{
id: 1,
type: "str",
value: "I am a very very very very very very very very very very very very very very very very very very very very very very very very very very very long string",
style: ["highlight"],
},
];
const output: InstanceType<typeof MemoryModel> = draw(objects, true, {
width: 100,
roughjs_config: {
options: {
seed: 12345,
},
},
});
const svg: string = output.serializeSVG();
expect(svg).toMatchSnapshot();
});
});

0 comments on commit 889c57f

Please sign in to comment.