I'm really enjoying statig but am facing challenges with unit testing state transitions. My goal is to:
- Initialize the state machine to a specific state.
- Mock dependencies within the state machine.
- Verify state transitions after handling events.
I'm using serde for state initialization (as suggested in #25), but this prevents me from setting mock expectations beforehand. See a reproducible example here: #33.
The issue is that neither UninitializedStateMachine<M> nor InitializedStateMachine<M> implement core::ops::DerefMut, preventing mutable access for mock configuration before initialization.
A potential solution is implementing DerefMut (#32), but I'm unsure if providing mutable access at all times is ideal. Perhaps implementing it only for UninitializedStateMachine<M> would be better? I'm open to suggestions.