def test_act__state_changed__subscriber_triggered(self): expected = {'some': 'object'} target = Store(test_state) subscriber = Mock() target.subscribe(subscriber) test_action = Action() test_action.act = Mock(return_value=expected) target.act(test_action) subscriber.assert_called_once()
def test_act__action_gets_state(self): target = Store(test_state) test_action = Action() def assertion(state): assert test_state == state return state test_action.act = assertion target.act(test_action)
def test_act__one_middleware__middleware_is_called(self): sideeffect = Mock() def middleware(next): def apply(action): sideeffect() next(action) return apply target = Store(test_state, [middleware]) test_action = Action() target.act(test_action) sideeffect.assert_called_once()
def test_act__returns_a_copy(self): target = Action() actual = target.act(test_state) assert test_state == actual
def test_act__returns_another_object(self): target = Action() actual = target.act(test_state) assert not test_state is actual