Last active
June 28, 2017 14:57
-
-
Save jasongaare/5d8f1ac81e70e9321f7e4b8f75ec2ace 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
import mockStore from 'redux-mock-store'; | |
const store = mockStore(); | |
describe('Testing log in authentication', () => { | |
beforeEach(() => { | |
store.clearActions(); | |
}); | |
it('attempt with correct password succeeds', async () => { | |
await store.dispatch(authenticateUser('email@test.com', 'password')); | |
expect(store.getActions()).toMatchSnapshot(); | |
}); | |
it('attempt with wrong password fails as expected', async () => { | |
await store.dispatch(authenticateUser('email@test.com', 'wrong')) | |
.catch((error) => { | |
const errorObject = { ...error }; | |
delete errorObject.duration; | |
expect(errorObject).toMatchSnapshot(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment