Skip to content

Instantly share code, notes, and snippets.

@Gethyl
Last active August 26, 2017 23:19
Show Gist options
  • Save Gethyl/4a778f29ca3495140e423d46c9da1016 to your computer and use it in GitHub Desktop.
Save Gethyl/4a778f29ca3495140e423d46c9da1016 to your computer and use it in GitHub Desktop.
//*******************************************************************************************************
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