Skip to content

Commit

Permalink
shallow to mount in steps, removes snapshots, codeforboston#966
Browse files Browse the repository at this point in the history
All except household, which has to be fixed where the error
is happening.
  • Loading branch information
knod committed Nov 4, 2018
1 parent 71c1687 commit 302838d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 845 deletions.
40 changes: 20 additions & 20 deletions src/test/forms/CurrentBenefits.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';

import { CurrentBenefitsStep } from '../../forms/CurrentBenefits';

Expand All @@ -10,28 +10,28 @@ import { getTextForLanguage } from '../../utils/getTextForLanguage';


var snippets = getTextForLanguage(`en`);
test('Benefits step component renders as snapshot correctly', () => {
test('Benefits step component should render without error', () => {
const navData = {
left: null,
middle: null,
right: { text: 'Next', onClick: jest.fn() },
right: (<div>CB right</div>),
},
updateClientValue = jest.fn(),
saveForm = jest.fn(),
askToResetClient = jest.fn(),
openFeedback = jest.fn(),
formSnippets = snippets.visitPage.currentBenefits;
updateClientValue = jest.fn(),
saveForm = jest.fn(),
askToResetClient = jest.fn(),
openFeedback = jest.fn(),
benefitsSnippets = snippets.visitPage.currentBenefits;

const wrapper = shallow(
<CurrentBenefitsStep
client = { CLIENT_DEFAULTS }
navData = { navData }
updateClientValue = { updateClientValue }
saveForm = { saveForm }
askToResetClient = { askToResetClient }
openFeedback = { openFeedback }
snippets = { formSnippets } />
);

expect(wrapper).toMatchSnapshot();
expect(() => {
mount(
<CurrentBenefitsStep
client = { CLIENT_DEFAULTS }
navData = { navData }
updateClientValue = { updateClientValue }
saveForm = { saveForm }
askToResetClient = { askToResetClient }
openFeedback = { openFeedback }
snippets = { benefitsSnippets } />
);
}).not.toThrow();
});
42 changes: 21 additions & 21 deletions src/test/forms/CurrentExpenses.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';

import { CurrentExpensesStep } from '../../forms/CurrentExpenses';

Expand All @@ -10,28 +10,28 @@ import { getTextForLanguage } from '../../utils/getTextForLanguage';


var snippets = getTextForLanguage(`en`);
test('Expenses step component renders as snapshot correctly', () => {
test('Expenses step component should render without error', () => {
const navData = {
left: { text: 'Previous', onClick: jest.fn() },
left: (<div>Exp left</div>),
middle: null,
right: { text: 'Next', onClick: jest.fn() },
right: (<div>Exp right</div>),
},
updateClientValue = jest.fn(),
saveForm = jest.fn(),
askToResetClient = jest.fn(),
openFeedback = jest.fn(),
formSnippets = snippets.visitPage.currentExpenses;
updateClientValue = jest.fn(),
saveForm = jest.fn(),
askToResetClient = jest.fn(),
openFeedback = jest.fn(),
formSnippets = snippets.visitPage.currentExpenses;

const wrapper = shallow(
<CurrentExpensesStep
client = { CLIENT_DEFAULTS }
navData = { navData }
updateClientValue = { updateClientValue }
saveForm = { saveForm }
askToResetClient = { askToResetClient }
openFeedback = { openFeedback }
snippets = { formSnippets } />
);

expect(wrapper).toMatchSnapshot();
expect(() => {
mount(
<CurrentExpensesStep
client = { CLIENT_DEFAULTS }
navData = { navData }
updateClientValue = { updateClientValue }
saveForm = { saveForm }
askToResetClient = { askToResetClient }
openFeedback = { openFeedback }
snippets = { formSnippets } />
);
}).not.toThrow();
});
45 changes: 22 additions & 23 deletions src/test/forms/CurrentIncome.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';

import { CurrentIncomeStep } from '../../forms/CurrentIncome';

Expand All @@ -10,29 +10,28 @@ import { getTextForLanguage } from '../../utils/getTextForLanguage';


var snippets = getTextForLanguage(`en`);

test('Income step component renders as snapshot correctly', () => {
test('Income step component should render without error', () => {
const navData = {
left: { text: 'Previous', onClick: jest.fn() },
left: (<div>Inc left</div>),
middle: null,
right: { text: 'Next', onClick: jest.fn() },
right: (<div>Inc right</div>),
},
updateClientValue = jest.fn(),
saveForm = jest.fn(),
askToResetClient = jest.fn(),
openFeedback = jest.fn(),
formSnippets = snippets.visitPage.currentIncome;

const wrapper = shallow(
<CurrentIncomeStep
client = { CLIENT_DEFAULTS }
navData = { navData }
updateClientValue = { updateClientValue }
saveForm = { saveForm }
askToResetClient = { askToResetClient }
openFeedback = { openFeedback }
snippets = { formSnippets } />
);

expect(wrapper).toMatchSnapshot();
updateClientValue = jest.fn(),
saveForm = jest.fn(),
askToResetClient = jest.fn(),
openFeedback = jest.fn(),
formSnippets = snippets.visitPage.currentIncome;

expect(() => {
mount(
<CurrentIncomeStep
client = { CLIENT_DEFAULTS }
navData = { navData }
updateClientValue = { updateClientValue }
saveForm = { saveForm }
askToResetClient = { askToResetClient }
openFeedback = { openFeedback }
snippets = { formSnippets } />
);
}).not.toThrow();
});
138 changes: 0 additions & 138 deletions src/test/forms/__snapshots__/CurrentBenefits.test.js.snap

This file was deleted.

Loading

0 comments on commit 302838d

Please sign in to comment.