Files
Matthew Rathbone e4e6149b33 test: add @BeforeRemove guards and unit tests for folder models
Add entity-level deletion guards to QueryFolder and ConnectionFolder:
if a folder still has queries/connections, .remove() throws a
descriptive error before touching the database. This mirrors the
cloud API behaviour where non-empty folders cannot be deleted.

Unit tests (18 total, 9 per model) cover:
- Basic save/retrieve
- Deletion blocked when folder contains items (checks error message,
  count wording, singular vs plural)
- Deletion succeeds when folder is empty
- Deletion succeeds after items are moved out (items survive)
- Parent folder relationship is persisted correctly
- Deleting a parent folder (no direct items) succeeds and sets
  child folder parentId to NULL via DB-level SET NULL

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 13:20:19 -06:00
..