Test Cases
| 🕙 Start time | ⌛ Duration |
|---|---|
| 5/19/2026, 2:21:20 PM | 3.287 s |
| ✅ Passed | ❌ Failed | ⏩ Skipped | 🚧 Todo | ⚪ Total | |
|---|---|---|---|---|---|
| Test Suites | 6 | 0 | 1 | 0 | 7 |
| Tests | 17 | 0 | 2 | 0 | 19 |
✅ tests/store.test.ts [link]
6 passed, 0 failed, 0 skipped, 0 todo, done in 31.820942999999716 s
✅ store.ts (per-id stores)
✅ initializeFSM with class returns static id and creates an instance
✅ initializeFSM with props uses provided id and creates an instance once
✅ getStore.getSnapshot throws when FSM not initialized for the id
✅ subscribe returns unsubscribe and changeState notifies only current id subscribers
✅ initializeFSM(class) does not notify subscribers during render/init; notifications occur only on changeState
✅ multiple automata ids are isolated (changeState for one id does not affect others)✅ tests/useFSM.test.ts [link]
5 passed, 0 failed, 0 skipped, 0 todo, done in 138.0333230000001 s
✅ useFSM tests
✅ instance class by automata id
✅ change state after action
✅ trace previous context
✅ check singleton
✅ 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 204.4708639999999 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