Add snapshot test coverage

Added snapshot test coverage, cleaned up some code aesthetics, and added state machine mocking.

/cc: @philips @xiangli-cmu