-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Appoint a Rep component unit tests (#33325)
* Moved parseRepType to helpers * Added test data for initialized form data * parse rep type unit test * SubmissionError unit test * Removed unused component * Removed confirmClaimantPersonalInformation (not in use) * Contact Accredited Rep unit tests * Added check for review mode before routing to review page * Select Accredited Representative unit tests * Refactor selectOrganization tests * Added test to render organization for selectAccreditedRepresentativeReview * ClaimantType unit test * Uncommented test * Added render test for GetFormHelp * removed repetitive comments * Fixed useRef definition * Refactored unit tests for legibility * Refactor unit test for legibility * Added .current prop for comparing newly selected rep to previous one * Form config unit tests * Deleted prefill transformer (unused)
- Loading branch information
Showing
20 changed files
with
1,263 additions
and
373 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
62 changes: 0 additions & 62 deletions
62
src/applications/representative-appoint/components/VeteranDetails.jsx
This file was deleted.
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
23 changes: 0 additions & 23 deletions
23
src/applications/representative-appoint/pages/claimant/confirmClaimantPersonalInformation.js
This file was deleted.
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
100 changes: 0 additions & 100 deletions
100
src/applications/representative-appoint/prefill-transformer.js
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
src/applications/representative-appoint/tests/components/GetFormHelp.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,12 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { expect } from 'chai'; | ||
import GetFormHelp from '../../components/GetFormHelp'; | ||
|
||
describe('GetFormHelp', () => { | ||
it('should render', () => { | ||
const { container } = render(<GetFormHelp />); | ||
|
||
expect(container).to.exist; | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
src/applications/representative-appoint/tests/components/SubmissionError.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,37 @@ | ||
import React from 'react'; | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { expect } from 'chai'; | ||
|
||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
|
||
import SubmissionError from '../../components/SubmissionError'; | ||
|
||
describe('SubmissionError', () => { | ||
it('should render', async () => { | ||
global.window.dataLayer = []; | ||
const form = { inProgressFormId: '1234' }; | ||
const heading = 'We couldn’t generate your form'; | ||
|
||
const { container, rerender } = render( | ||
<div> | ||
<SubmissionError form={form} /> | ||
</div>, | ||
); | ||
|
||
expect($('va-alert[status="error"]', container)).to.exist; | ||
|
||
const h3 = $('h3', container); | ||
expect(h3.textContent).to.eq(heading); | ||
|
||
// rerendering to test alertRef scroll & focus branch (not working?) | ||
await rerender( | ||
<div> | ||
<SubmissionError form={form} /> | ||
</div>, | ||
); | ||
|
||
await waitFor(() => { | ||
expect(document.activeElement).to.eq(h3); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.