Test Cases
| 🕙 Start time | ⌛ Duration |
|---|---|
| 6/14/2026, 3:53:13 PM | 3.261 s |
| ✅ Passed | ❌ Failed | ⏩ Skipped | 🚧 Todo | ⚪ Total | |
|---|---|---|---|---|---|
| Test Suites | 6 | 0 | 1 | 0 | 7 |
| Tests | 18 | 0 | 2 | 0 | 20 |
✅ tests/store.test.ts [link]
7 passed, 0 failed, 0 skipped, 0 todo, done in 31.151303999999982 s
✅ store.ts (per-id stores)
✅ initializeFSM with instance returns correlationId and registers it
✅ initializeFSM with same instance twice returns same id and does not re-register
✅ getStore.getSnapshot throws when FSM not initialized for the id
✅ subscribe returns unsubscribe and changeState notifies only current id subscribers
✅ initializeFSM does not notify subscribers during init; notifications occur only on changeState
✅ multiple instances are isolated (changeState for one does not affect others)
✅ fsm_context.destroyFSM removes instance and store from registries✅ tests/useFSM.test.ts [link]
5 passed, 0 failed, 0 skipped, 0 todo, done in 104.07725100000016 s
✅ useFSM tests
✅ same instance reuses the same store
✅ change state after action
✅ trace previous context
✅ different instances have isolated automata
✅ does not re-render when dispatch results in the same state and context (isEqual guards)✅ tests/useFSMWithSelector.test.ts [link]
6 passed, 0 failed, 2 skipped, 0 todo, done in 146.8474940000001 s
✅ useFSMWithSelector tests (selector-based hook)
✅ basic selector returns context
✅ selection reference is preserved when logically equal (isEqual preserves reference)
✅ without isEqual, selection reference changes even if logical value stays same
✅ constant primitive selection keeps the same value across transitions
✅ primitive boolean selection remains true for Red -> RedYellow
✅ selector: throws when selection returns null/undefined
⏩ selective re-render with second counter
⏩ selector: context.counter — Switch_1 after first Switch does not trigger re-render
⏩ selector: context.counter2 — reacts only to Switch_1; Switch does not trigger re-render