From c5a12034a52cb302f3f2f7a5fa6c26b7c322f80a Mon Sep 17 00:00:00 2001
From: yoonieaj <144498960+yoonieaj@users.noreply.github.com>
Date: Tue, 21 May 2024 20:28:23 -0400
Subject: [PATCH] Add tests for automatic layout and style options (#32)
---
CHANGELOG.md | 1 +
.../tests/__snapshots__/draw.spec.tsx.snap | 28 ++
memory-viz/src/tests/draw.spec.tsx | 412 ++++++++++++++++++
3 files changed, 441 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 25629534..2ef23f92 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Fix CI build action for demo website.
- Added data type and manual layout tests for the `draw` function.
- Updated file paths for example files under docs to import the correct file.
+- Added style and automatic layout tests for the `draw` function.
## [0.1.0] - 2024-04-16
diff --git a/memory-viz/src/tests/__snapshots__/draw.spec.tsx.snap b/memory-viz/src/tests/__snapshots__/draw.spec.tsx.snap
index 1e2e4a61..e1627135 100644
--- a/memory-viz/src/tests/__snapshots__/draw.spec.tsx.snap
+++ b/memory-viz/src/tests/__snapshots__/draw.spec.tsx.snap
@@ -1,5 +1,27 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`draw function formats a mix of stack frame/non-stack frame objects in automatic layout 1`] = `""`;
+
+exports[`draw function formats non-stack frame objects in automatic layout 1`] = `""`;
+
+exports[`draw function renders 'fade' style preset 1`] = `""`;
+
+exports[`draw function renders 'fade_id' style preset 1`] = `""`;
+
+exports[`draw function renders 'fade_type' style preset 1`] = `""`;
+
+exports[`draw function renders 'hide' style preset 1`] = `""`;
+
+exports[`draw function renders 'hide_container' style preset 1`] = `""`;
+
+exports[`draw function renders 'hide_id' style preset 1`] = `""`;
+
+exports[`draw function renders 'highlight' style preset 1`] = `""`;
+
+exports[`draw function renders 'highlight_id' style preset 1`] = `""`;
+
+exports[`draw function renders 'highlight_type' style preset 1`] = `""`;
+
exports[`draw function renders a blank space 1`] = `""`;
exports[`draw function renders a bool 1`] = `""`;
@@ -38,4 +60,10 @@ exports[`draw function renders an int 1`] = `""`;
+exports[`draw function renders blank spaces in automatic layout 1`] = `""`;
+
+exports[`draw function renders combinations of style presets 1`] = `""`;
+
+exports[`draw function renders custom style (without presets) 1`] = `""`;
+
exports[`draw function should produce consistent svg when provided seed 1`] = `""`;
diff --git a/memory-viz/src/tests/draw.spec.tsx b/memory-viz/src/tests/draw.spec.tsx
index 6752b45e..e287862e 100644
--- a/memory-viz/src/tests/draw.spec.tsx
+++ b/memory-viz/src/tests/draw.spec.tsx
@@ -302,4 +302,416 @@ describe("draw function", () => {
const svg: String = m.serializeSVG();
expect(svg).toMatchSnapshot();
});
+
+ it("renders blank spaces in automatic layout", () => {
+ const objects: Array