Skip to content

Instantly share code, notes, and snippets.

@dmitryshelomanov
Created December 11, 2017 10:21
Show Gist options
  • Save dmitryshelomanov/02afb9ad76a9868552e46f934fd34d6c to your computer and use it in GitHub Desktop.
Save dmitryshelomanov/02afb9ad76a9868552e46f934fd34d6c to your computer and use it in GitHub Desktop.
react testing reducer
it.only('counter COUNTER_PLUS state', () => {
const store = global.mockStore(INITIAL_STATE)
const actions = store.dispatch(plus(1))
const testFn = counter(store.getState(), actions)
expect(testFn).toEqual({
number: 1
})
expect(store.getActions()[0]).toEqual({
type: types.COUNTER_PLUS,
payload: 1
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment