Last active
August 26, 2017 23:19
-
-
Save Gethyl/4a778f29ca3495140e423d46c9da1016 to your computer and use it in GitHub Desktop.
This file contains 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
//******************************************************************************************************* | |
describe('>>>H O M E --- REACT-REDUX (Mount + wrapping in <Provider>)',()=>{ | |
const initialState = {output:10} | |
const mockStore = configureStore() | |
let store,wrapper | |
beforeEach(()=>{ | |
store = mockStore(initialState) | |
wrapper = mount( <Provider store={store}><ConnectedHome /></Provider> ) | |
}) | |
it('+++ render the connected(SMART) component', () => { | |
expect(wrapper.find(ConnectedHome).length).toEqual(1) | |
}); | |
it('+++ check Prop matches with initialState', () => { | |
expect(wrapper.find(Home).prop('output')).toEqual(initialState.output) | |
}); | |
it('+++ check action on dispatching ', () => { | |
let action | |
store.dispatch(addInputs(500)) | |
store.dispatch(subtractInputs(100)) | |
action = store.getActions() | |
expect(action[0].type).toBe("ADD_INPUTS") | |
expect(action[1].type).toBe("SUBTRACT_INPUTS") | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment