Last active
June 8, 2017 14:35
-
-
Save jasongaare/95964752a2bf14e4e5b6e74627e64b94 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'; | |
import { authenticateUser } from 'actions/sessions'; | |
import { LOGOUT } from 'constants/actions'; | |
import user from 'reducers/user'; | |
import { testUser } from 'jest/mock-objects'; | |
describe('Testing log in authentication', () => { | |
const store = mockStore(); | |
beforeEach(() => { | |
store.clearActions(); | |
}); | |
it('attempt with correct password succeeds', async () => { | |
await store.dispatch(authenticateUser('email@website.com', 'password')); | |
expect(store.getActions()).toMatchSnapshot(); | |
}); | |
}); | |
describe('Testing reducers after LOGOUT action', () => { | |
it('set user to initial state', () => { | |
expect(user(testUser, { type: LOGOUT })).toMatchSnapshot(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment