Skip to content

Test save and reload for complex scenes (#482) - #511

Merged
mudabs merged 1 commit into
oss-slu:mainfrom
Subomiadekunle:test-save-and-reload-482
Oct 28, 2026
Merged

mudabs merged 1 commit into
oss-slu:mainfrom
Subomiadekunle:test-save-and-reload-482

Conversation

@Subomiadekunle

Copy link
Copy Markdown
Collaborator

Closes #482 (part of #477)

Adds boneset-api/saveReload.test.js, which checks that saved scenes come back with complete visual fidelity.

What's tested

  • Reopen: a complex scene saves and reopens from a fresh store (simulating closing and reopening).
  • Images: 5 images covering move, resize, rotation (including negative and decimal), horizontal and vertical flip, crop, and a legacy import. Every field and the layer order are compared one by one.
  • Annotations: text labels (font size, color, linked image), a pointer line, and a colored region. Content, position, style, and order are compared.
  • Re-save: reordering images and annotations and saving again keeps the new order and edits.
  • Discard: unsaved edits are not stored, and reopening returns the last saved version. The editor's discard flow itself is covered in templates/tests/scenes.test.js ("discards the copy without storing it when the user agrees").
  • Failed saves (from the issue notes): a storage failure (500), invalid content (400), and a save from an out-of-date copy (412) all leave the saved scene unchanged, and saving works again once storage recovers.

Manual verification
Created a scene, imported Ilium with labels and regions, then moved, resized, rotated, flipped, cropped, and reordered images. Saved, refreshed the page, and reopened: everything matched. Made another edit, discarded it, and reopened: the edit was gone.

image ![Uploading image.png…]()

Testing

  • npx jest boneset-api/saveReload.test.js: 11 tests pass
  • npm test: all suites pass
  • npm run lint: clean

Saves a scene with mixed image edits (move, resize, rotate, flip, crop, order) and text/line/region annotations, reopens it from a fresh store, and compares every field. Covers re-saving after reordering, discarding unsaved changes, and failed saves (storage error, invalid content, stale copy).

@mudabs mudabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

Thank you Subomi for the thorough test coverage. This PR verifies that complex scenes preserve image properties, annotation properties, layer ordering, edits after a second save, and the last saved version after discarded changes.

The failure cases for storage errors, invalid content, and stale scene versions are also valuable because they confirm that failed saves do not overwrite the previously saved scene.

I ran the focused test suite and the full test suite successfully, and lint is clean. I’m approving this PR.

@mudabs

mudabs commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

I also appreciate the manual image verifications!

@mudabs
mudabs merged commit b05e108 into oss-slu:main Oct 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Small Rock] Test Save and Reload

2 participants