Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Created August 29, 2016 23:36
Show Gist options
  • Save ccorcos/0e035cafc4e6ebce5b36093d931f472a to your computer and use it in GitHub Desktop.
Save ccorcos/0e035cafc4e6ebce5b36093d931f472a to your computer and use it in GitHub Desktop.
describe('App Reducer', () => {
it('MAKE_PAYMENT_SUCCESS', () => {
const state = Immutable.Map()
const loan = Symbol()
const mutations = [
expect.spyOn('mutate', 'updateLoan').andCall(loan => s => s)
expect.spyOn('mutate', 'closeModal').andCall(s => s)
expect.spyOn('mutate', 'stopLoading').andCall(s => s)
]
const result = reducer(state, actions.makePaymentSuccess(loan))
expect(mutations[0]).toHaveBeenCalledWith(loan)
mutations.slice(1).forEach(mutation => {
expect(mutation).toHaveBeenCalled()
})
expect(result).toEqual(state)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment