Test Cases
| 🕙 Start time | ⌛ Duration |
|---|---|
| 4/29/2026, 4:20:25 PM | 1.946 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 10.28696500000001 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 38.40509999999995 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 65.10783400000014 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