fleet/frontend/pages/ResetPasswordPage/ResetPasswordPage.tests.jsx
Mike Stone 0e08a6e698 Reset password page submit (#184)
* API client sends reset password requests

* ResetPasswordPage actions and reducer

* Reset password happy path
2016-09-19 11:35:38 -04:00

41 lines
1.1 KiB
JavaScript

import React from 'react';
import expect from 'expect';
import { mount } from 'enzyme';
import ConnectedPage, { ResetPasswordPage } from './ResetPasswordPage';
import testHelpers from '../../test/helpers';
describe('ResetPasswordPage - component', () => {
it('renders a ResetPasswordForm', () => {
const page = mount(<ResetPasswordPage token="ABC123" />);
expect(page.find('ResetPasswordForm').length).toEqual(1);
});
it('Redirects to the login page when there is no token', () => {
const { connectedComponent, reduxMockStore } = testHelpers;
const redirectToLoginAction = {
type: '@@router/CALL_HISTORY_METHOD',
payload: {
method: 'push',
args: ['/login'],
},
};
const store = {
components: {
ResetPasswordPage: {
loading: false,
error: null,
},
},
};
const mockStore = reduxMockStore(store);
mount(connectedComponent(ConnectedPage, { mockStore }));
const dispatchedActions = mockStore.getActions();
expect(dispatchedActions).toInclude(redirectToLoginAction);
});
});