added a test for the new state transition and message clearing