-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
243 additions
and
47 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,39 @@ describe('CustomerContactInfoForm Component', () => { | |
name: '', | ||
telephone: '', | ||
email: '', | ||
cacUser: true, | ||
}; | ||
const testProps = { | ||
initialValues, | ||
onSubmit: jest.fn(), | ||
onBack: jest.fn(), | ||
}; | ||
|
||
const initialValuesCacValidated = { | ||
firstName: 'joe', | ||
middleName: 'bob', | ||
lastName: 'bob', | ||
suffix: 'jr', | ||
customerTelephone: '855-222-1111', | ||
customerEmail: '[email protected]', | ||
customerAddress: { | ||
streetAddress1: '123 Happy St', | ||
streetAddress2: 'Unit 4', | ||
city: 'Missoula', | ||
state: 'MT', | ||
postalCode: '59802', | ||
}, | ||
name: 'joe bob', | ||
telephone: '855-222-1111', | ||
email: '[email protected]', | ||
cacUser: null, | ||
}; | ||
const testPropsCacValidated = { | ||
initialValuesCacValidated, | ||
onSubmit: jest.fn(), | ||
onBack: jest.fn(), | ||
}; | ||
|
||
it('renders the form inputs', async () => { | ||
render(<CustomerContactInfoForm {...testProps} />); | ||
|
||
|
@@ -63,6 +89,38 @@ describe('CustomerContactInfoForm Component', () => { | |
expect(screen.getByLabelText('Name')).toBeInstanceOf(HTMLInputElement); | ||
expect(screen.getAllByLabelText('Phone')[1]).toBeInstanceOf(HTMLInputElement); | ||
expect(screen.getAllByLabelText('Email')[1]).toBeInstanceOf(HTMLInputElement); | ||
|
||
expect(screen.getByText('CAC Validation')).toBeInstanceOf(HTMLHeadingElement); | ||
expect( | ||
screen.getByText('Is the customer a non-CAC user or do they need to bypass CAC validation?'), | ||
).toBeInTheDocument(); | ||
expect( | ||
screen.getByText( | ||
'If this is checked yes, then the customer has already validated their CAC or their identity has been validated by a trusted office user.', | ||
), | ||
).toBeInTheDocument(); | ||
expect(screen.getByTestId('cac-user-yes')).toBeInTheDocument(); | ||
expect(screen.getByTestId('cac-user-no')).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
it('does not allow submission without cac_validated value', async () => { | ||
render(<CustomerContactInfoForm {...testPropsCacValidated} />); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByText('CAC Validation')).toBeInstanceOf(HTMLHeadingElement); | ||
expect( | ||
screen.getByText('Is the customer a non-CAC user or do they need to bypass CAC validation?'), | ||
).toBeInTheDocument(); | ||
expect( | ||
screen.getByText( | ||
'If this is checked yes, then the customer has already validated their CAC or their identity has been validated by a trusted office user.', | ||
), | ||
).toBeInTheDocument(); | ||
expect(screen.getByTestId('cac-user-yes')).toBeInTheDocument(); | ||
expect(screen.getByTestId('cac-user-no')).toBeInTheDocument(); | ||
}); | ||
expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument(); | ||
expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled(); | ||
}); | ||
}); |
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
Oops, something went wrong.