Adds unit test for HA state transitioning