Created
October 18, 2016 19:03
-
-
Save pumpchaser/3ccd6ed0f53edde2acca586aeb3f0a53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from 'redux' | |
const subscribed = (state = false, action) => { | |
switch (action.type) { | |
case 'SET_SUBSCRIBED': | |
return true | |
default: | |
return state | |
} | |
} | |
const rootReducer = combineReducers({ | |
subscribed | |
}) | |
export default rootReducer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should handle the default action for passed in state', () => { | |
const action = { type: 'RANDOM-123' } | |
deepFreeze(action) | |
expect(reducer(true, action)).toEqual({ subscribed: true }) | |
}) | |
Expected { subscribed: false } to equal { subscribed: true } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment