finished unit tests for state machine