Add more tests for `workState`

And add helper for getting the SharedPreferences