-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix form submit transform issue * tests to bump coverage * ermove ssn field from submit field * wip: adding tests * Adds unit test for confirmation page container * name validation tests * name validation tests * add action specs' * adds prop types to intro page and unit tests for conditional rendering save in progress * remove code that wouldn't get hit and add more tests * more specs * Adds specs for obfuscate Review field component * more validation specs * adds specs to submit-transfrom for unchecked functions * Adds tests for presubmit info component --------- Co-authored-by: Brad Bergeron <[email protected]> Co-authored-by: Brad Bergeron <[email protected]>
- Loading branch information
1 parent
e9de3a6
commit 8728258
Showing
25 changed files
with
4,134 additions
and
344 deletions.
There are no files selected for viewing
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
...-dependent-education-benefit/22-5490/tests/components/DirectDepositViewField.unit.spec.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import DirectDepositViewField from '../../components/DirectDepositViewField'; | ||
|
||
describe('DirectDepositViewField component', () => { | ||
const initialState = { | ||
bankAccount: { | ||
accountType: 'checking', | ||
accountNumber: '123123123', | ||
routingNumber: '321321321', | ||
}, | ||
}; | ||
|
||
it('renders the DirectDepositViewField footer', () => { | ||
expect(<DirectDepositViewField />); | ||
}); | ||
|
||
it('should render obfuscated checking account information', () => { | ||
const wrapper = mount(<DirectDepositViewField formData={initialState} />); | ||
expect(wrapper.text()).to.include('Checking account'); | ||
expect(wrapper.text()).to.include('●●●●●1321'); | ||
expect(wrapper.text()).to.include('●●●●●3123'); | ||
wrapper.unmount(); | ||
}); | ||
|
||
it('should render account information when no account type is provided', () => { | ||
initialState.bankAccount.accountType = ''; | ||
|
||
const wrapper = mount(<DirectDepositViewField formData={initialState} />); | ||
expect(wrapper.text()).to.include('Account'); | ||
expect(wrapper.text()).to.include('●●●●●1321'); | ||
expect(wrapper.text()).to.include('●●●●●3123'); | ||
wrapper.unmount(); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
...endent-education-benefit/22-5490/tests/components/DuplicateContactInfoModal.unit.spec.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import { Provider } from 'react-redux'; | ||
import configureStore from 'redux-mock-store'; | ||
|
||
import DuplicateContactInfoModal from '../../components/DuplicateContactInfoModal'; | ||
|
||
const initialState = { | ||
form: { | ||
data: { | ||
email: { | ||
email: '[email protected]', | ||
}, | ||
}, | ||
}, | ||
data: { | ||
duplicateEmail: [{ dupe: true, acknowledged: undefined }], | ||
duplicatePhone: [], | ||
openModal: true, | ||
}, | ||
}; | ||
|
||
describe('DuplicateContactInfoModal', () => { | ||
const mockStore = configureStore(); | ||
|
||
const store = mockStore(initialState); | ||
|
||
it('should render with data', () => { | ||
const wrapper = mount( | ||
<Provider store={store}> | ||
<DuplicateContactInfoModal /> | ||
</Provider>, | ||
); | ||
|
||
expect(wrapper.text()).to.include('This will impact how we:'); | ||
|
||
wrapper.unmount(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...vivor-dependent-education-benefit/22-5490/tests/components/EmailReviewField.unit.spec.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import EmailReviewField from '../../components/EmailReviewField'; | ||
|
||
describe('EmailReviewField component', () => { | ||
it('renders the EmailReviewField footer', () => { | ||
const wrapper = mount( | ||
<EmailReviewField> | ||
<div formData="[email protected]" /> | ||
</EmailReviewField>, | ||
); | ||
expect(wrapper.text()).to.include('test'); | ||
|
||
wrapper.unmount(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
...ons/survivor-dependent-education-benefit/22-5490/tests/components/FormFooter.unit.spec.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import FormFooter from '../../components/FormFooter'; | ||
|
||
describe('FormFooter component', () => { | ||
it('renders the FormFooter footer', () => { | ||
const wrapper = mount(<FormFooter />); | ||
|
||
expect(wrapper.text()).to.include( | ||
'If you need help with your application or have questions about', | ||
); | ||
wrapper.unmount(); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
...ependent-education-benefit/22-5490/tests/components/MailingAddressViewField.unit.spec.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import MailingAddressViewField from '../../components/MailingAddressViewField'; | ||
|
||
describe('MailingAddressViewField component', () => { | ||
const initialState = { | ||
address: { | ||
street: '123 true st', | ||
street2: '#1', | ||
city: 'Fairfax', | ||
state: 'VA', | ||
postalCode: '22042', | ||
}, | ||
}; | ||
|
||
it('should render the mailing address', () => { | ||
const wrapper = mount(<MailingAddressViewField formData={initialState} />); | ||
expect(wrapper.text()).to.include('123 true st'); | ||
expect(wrapper.text()).to.include('#1'); | ||
expect(wrapper.text()).to.include('Fairfax'); | ||
expect(wrapper.text()).to.include('VA'); | ||
expect(wrapper.text()).to.include('22042'); | ||
wrapper.unmount(); | ||
}); | ||
}); |
52 changes: 52 additions & 0 deletions
52
...r-dependent-education-benefit/22-5490/tests/components/ObfuscateReviewField.unit.spec.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import ObfuscateReviewField from '../../components/ObfuscateReviewField'; | ||
|
||
describe('ObfuscateReviewField component', () => { | ||
it('renders without crashing', () => { | ||
const uiSchema = { 'ui:title': 'Obfuscated Title' }; | ||
const formData = 'Sensitive Information'; | ||
|
||
const wrapper = mount( | ||
<ObfuscateReviewField uiSchema={uiSchema}> | ||
<span formData={formData} /> | ||
</ObfuscateReviewField>, | ||
); | ||
|
||
expect(wrapper.exists()).to.be.true; | ||
wrapper.unmount(); | ||
}); | ||
|
||
it('displays the title from uiSchema', () => { | ||
const uiSchema = { 'ui:title': 'Obfuscated Title' }; | ||
const formData = 'Sensitive Information'; | ||
|
||
const wrapper = mount( | ||
<ObfuscateReviewField uiSchema={uiSchema}> | ||
<span formData={formData} /> | ||
</ObfuscateReviewField>, | ||
); | ||
|
||
expect(wrapper.find('dt').text()).to.equal('Obfuscated Title'); | ||
wrapper.unmount(); | ||
}); | ||
|
||
it('obfuscates the formData content', () => { | ||
const uiSchema = { 'ui:title': 'Obfuscated Title' }; | ||
const formData = 'Sensitive Information'; | ||
|
||
const wrapper = mount( | ||
<ObfuscateReviewField uiSchema={uiSchema}> | ||
<span formData={formData} /> | ||
</ObfuscateReviewField>, | ||
); | ||
|
||
const obfuscatedText = wrapper.find('dd').text(); | ||
|
||
// Adjusted expectation to check for `●` characters | ||
expect(obfuscatedText).to.not.equal(formData); | ||
expect(obfuscatedText).to.match(/●+/); // Checks if the obfuscation contains `●` characters | ||
wrapper.unmount(); | ||
}); | ||
}); |
Oops, something went wrong.