Skip to content

Instantly share code, notes, and snippets.

@jasongaare
Last active June 8, 2017 14:35
Show Gist options
  • Save jasongaare/95964752a2bf14e4e5b6e74627e64b94 to your computer and use it in GitHub Desktop.
Save jasongaare/95964752a2bf14e4e5b6e74627e64b94 to your computer and use it in GitHub Desktop.
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