Context
PR #110 (closes #107) shipped a uiStore.test.ts test that verifies the canvas empty-state gate by evaluating the boolean expression directly — without ever mounting ACCanvas or asserting on the actual DOM. Copilot flagged this on review, and the concern is well-founded.
During testing on PR #110 a real bug shipped briefly: the conditional logic was accidentally inverted, causing the populated home view to render behind the TownManager drawer instead of being suppressed. A locally-evaluated boolean test has no way to catch that class of regression — it only checks whether the expression evaluates correctly, not whether the component renders correctly based on it.
What to add
A small render test suite for ACCanvas that:
- Mocks
useAppStore, useUIStore, and useMuseumData (all have straightforward interfaces).
- Exercises the four meaningful permutations of
(noTowns, townManagerOpen):
- No towns + TownManager open → canvas renders nothing (null / empty subtree)
- No towns + TownManager closed → empty-state UI
- Towns present + TownManager open → FullView still renders (drawer is an overlay, not a suppressor)
- Towns present + TownManager closed → FullView renders
- Asserts on the actual rendered DOM output (presence/absence of key elements) rather than on a re-evaluated boolean.
If the gating logic gets more complex over time, consider extracting it into a named helper (shouldSuppressCanvas or similar) so both the component and the test share the same source of truth and a logic change is impossible to miss.
Why this matters
The inverted-logic bug described above would have been caught by step 2 of the test above the moment the conditional changed. The current boolean-only test would have continued to pass. Render tests are the right tool here.
Target
Planned for v0.9.4-beta (hardening / test coverage pass).
References
Context
PR #110 (closes #107) shipped a
uiStore.test.tstest that verifies the canvas empty-state gate by evaluating the boolean expression directly — without ever mountingACCanvasor asserting on the actual DOM. Copilot flagged this on review, and the concern is well-founded.During testing on PR #110 a real bug shipped briefly: the conditional logic was accidentally inverted, causing the populated home view to render behind the TownManager drawer instead of being suppressed. A locally-evaluated boolean test has no way to catch that class of regression — it only checks whether the expression evaluates correctly, not whether the component renders correctly based on it.
What to add
A small render test suite for
ACCanvasthat:useAppStore,useUIStore, anduseMuseumData(all have straightforward interfaces).(noTowns, townManagerOpen):If the gating logic gets more complex over time, consider extracting it into a named helper (
shouldSuppressCanvasor similar) so both the component and the test share the same source of truth and a logic change is impossible to miss.Why this matters
The inverted-logic bug described above would have been caught by step 2 of the test above the moment the conditional changed. The current boolean-only test would have continued to pass. Render tests are the right tool here.
Target
Planned for v0.9.4-beta (hardening / test coverage pass).
References