blob: 0e9222129deb1cbdd3921dfc818b4cccc8ec8281 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import { shallow } from 'enzyme';
import expect from 'expect';
import React from 'react';
import { AdminRecoveryCodeForm } from 'src/account_recovery/forms/admin_recovery_code_form';
describe('AdminRecoveryCodeForm', () => {
let adminRecoveryCodeForm;
let mockNext;
beforeEach(() => {
const mockTranslations = key => key;
mockNext = expect.createSpy();
adminRecoveryCodeForm = shallow(
<AdminRecoveryCodeForm t={mockTranslations} next={mockNext} />
);
});
it('renders title for admin recovery code', () => {
expect(adminRecoveryCodeForm.find('h1').text()).toEqual('account-recovery.admin-form.title');
});
it('renders tips for retrieving recovery code', () => {
expect(adminRecoveryCodeForm.find('li').length).toEqual(3);
});
it('renders input field for admin code', () => {
expect(adminRecoveryCodeForm.find('InputField').props().name).toEqual('admin-code');
});
it('renders button for next step', () => {
expect(adminRecoveryCodeForm.find('SubmitButton').props().buttonText).toEqual('account-recovery.admin-form.button');
});
it('submits form to next step', () => {
adminRecoveryCodeForm.find('form').simulate('submit');
expect(mockNext).toHaveBeenCalled();
});
});
|