-
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 container unit tests (#33510)
* Authorization unit tests * Veteran unit tests * Deleted unused page * Moved claimant tests into subfolder * commenting out test * NextStepsPage unit test * Intro page unit test * Uncommenting + skipping test for now
- Loading branch information
Showing
22 changed files
with
477 additions
and
68 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
36 changes: 0 additions & 36 deletions
36
...pplications/representative-appoint/pages/veteran/veteranContactPhoneEmailForNonVeteran.js
This file was deleted.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
src/applications/representative-appoint/tests/containers/IntroductionPage.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,90 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { render } from '@testing-library/react'; | ||
import { expect } from 'chai'; | ||
|
||
import { $, $$ } from 'platform/forms-system/src/js/utilities/ui'; | ||
|
||
import IntroductionPage from '../../containers/IntroductionPage'; | ||
import formConfig from '../../config/form'; | ||
|
||
const getData = ({ | ||
loggedIn = true, | ||
isVerified = true, | ||
data = {}, | ||
contestedIssues = {}, | ||
} = {}) => ({ | ||
props: { | ||
loggedIn, | ||
location: { | ||
basename: '/sc-base-url', | ||
}, | ||
route: { | ||
formConfig, | ||
pageList: [{ path: '/introduction' }, { path: '/next', formConfig }], | ||
}, | ||
}, | ||
mockStore: { | ||
getState: () => ({ | ||
user: { | ||
login: { | ||
currentlyLoggedIn: loggedIn, | ||
}, | ||
profile: { | ||
userFullName: { last: 'last' }, | ||
dob: '2000-01-01', | ||
claims: { appeals: true }, | ||
savedForms: [], | ||
prefillsAvailable: [], | ||
verified: isVerified, | ||
}, | ||
}, | ||
form: { | ||
formId: formConfig.formId, | ||
loadedStatus: 'success', | ||
savedStatus: '', | ||
loadedData: { | ||
metadata: {}, | ||
}, | ||
data, | ||
contestedIssues, | ||
}, | ||
scheduledDowntime: { | ||
globalDowntime: null, | ||
isReady: true, | ||
isPending: false, | ||
serviceMap: { get() {} }, | ||
dismissedDowntimeWarnings: [], | ||
}, | ||
}), | ||
subscribe: () => {}, | ||
dispatch: () => {}, | ||
}, | ||
}); | ||
|
||
describe('IntroductionPage', () => { | ||
it('should render', () => { | ||
const { props, mockStore } = getData({ loggedIn: false }); | ||
const { container } = render( | ||
<Provider store={mockStore}> | ||
<IntroductionPage {...props} /> | ||
</Provider>, | ||
); | ||
expect($('h1', container).textContent).to.eq( | ||
'Get help from a VA accredited representative or VSO', | ||
); | ||
expect($('va-process-list', container)).to.exist; | ||
expect($('va-omb-info', container)).to.exist; | ||
expect($('va-alert[status="info"]', container)).to.exist; | ||
}); | ||
|
||
it('should render start action links', () => { | ||
const { props, mockStore } = getData(); | ||
const { container } = render( | ||
<Provider store={mockStore}> | ||
<IntroductionPage {...props} /> | ||
</Provider>, | ||
); | ||
expect($$('.vads-c-action-link--green', container).length).to.equal(2); | ||
}); | ||
}); |
31 changes: 31 additions & 0 deletions
31
src/applications/representative-appoint/tests/containers/NextStepsPage.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,31 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { Provider } from 'react-redux'; | ||
import { expect } from 'chai'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
import NextStepsPage from '../../containers/NextStepsPage'; | ||
import mockFormData from '../fixtures/data/21-22a/form-data.json'; | ||
|
||
describe('<NextStepsPage />', () => { | ||
const mockStore = configureMockStore(); | ||
|
||
it('renders the component with mocked Redux store', () => { | ||
const store = mockStore({ | ||
form: { | ||
data: mockFormData, | ||
}, | ||
}); | ||
|
||
const { container } = render( | ||
<Provider store={store}> | ||
<NextStepsPage /> | ||
</Provider>, | ||
); | ||
|
||
expect($('h1', container).textContent).to.eq( | ||
'Get help from a VA accredited representative or VSO', | ||
); | ||
expect($('h2', container).textContent).to.eq('Your next steps'); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
...ications/representative-appoint/tests/pages/authorizations/authorizeAddress.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,29 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { DefinitionTester } from 'platform/testing/unit/schemaform-utils'; | ||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
import mockFormData from '../../fixtures/data/form-data.json'; | ||
import formConfig from '../../../config/form'; | ||
|
||
describe('Authorize address page', () => { | ||
const { | ||
schema, | ||
uiSchema, | ||
} = formConfig.chapters.authorization.pages.authorizeAddress; | ||
|
||
it('should render', () => { | ||
const { container } = render( | ||
<DefinitionTester | ||
definitions={{}} | ||
schema={schema} | ||
uiSchema={uiSchema} | ||
data={{}} | ||
formData={mockFormData} | ||
/>, | ||
); | ||
|
||
expect($('button[type="submit"]', container)).to.exist; | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
...cations/representative-appoint/tests/pages/authorizations/authorizeInsideVA.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,29 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { DefinitionTester } from 'platform/testing/unit/schemaform-utils'; | ||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
|
||
import formConfig from '../../../config/form'; | ||
|
||
describe('Authorize Inside VA page', () => { | ||
const { | ||
schema, | ||
uiSchema, | ||
} = formConfig.chapters.authorization.pages.authorizeInsideVA; | ||
|
||
it('should render', () => { | ||
const { container } = render( | ||
<DefinitionTester | ||
definitions={{}} | ||
schema={schema} | ||
uiSchema={uiSchema} | ||
data={{}} | ||
formData={{}} | ||
/>, | ||
); | ||
|
||
expect($('button[type="submit"]', container)).to.exist; | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
...ications/representative-appoint/tests/pages/authorizations/authorizeMedical.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,29 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { DefinitionTester } from 'platform/testing/unit/schemaform-utils'; | ||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
|
||
import formConfig from '../../../config/form'; | ||
|
||
describe('Authorize medical page', () => { | ||
const { | ||
schema, | ||
uiSchema, | ||
} = formConfig.chapters.authorization.pages.authorizeMedical; | ||
|
||
it('should render', () => { | ||
const { container } = render( | ||
<DefinitionTester | ||
definitions={{}} | ||
schema={schema} | ||
uiSchema={uiSchema} | ||
data={{}} | ||
formData={{}} | ||
/>, | ||
); | ||
|
||
expect($('button[type="submit"]', container)).to.exist; | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
...ns/representative-appoint/tests/pages/authorizations/authorizeMedicalSelect.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,29 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { DefinitionTester } from 'platform/testing/unit/schemaform-utils'; | ||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
|
||
import formConfig from '../../../config/form'; | ||
|
||
describe('Authorize medical select page', () => { | ||
const { | ||
schema, | ||
uiSchema, | ||
} = formConfig.chapters.authorization.pages.authorizeMedicalSelect; | ||
|
||
it('should render', () => { | ||
const { container } = render( | ||
<DefinitionTester | ||
definitions={{}} | ||
schema={schema} | ||
uiSchema={uiSchema} | ||
data={{}} | ||
formData={{}} | ||
/>, | ||
); | ||
|
||
expect($('button[type="submit"]', container)).to.exist; | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
...ations/representative-appoint/tests/pages/authorizations/authorizeOutsideVA.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,29 @@ | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { DefinitionTester } from 'platform/testing/unit/schemaform-utils'; | ||
import { $ } from 'platform/forms-system/src/js/utilities/ui'; | ||
|
||
import formConfig from '../../../config/form'; | ||
|
||
describe('Authorize Outside VA page', () => { | ||
const { | ||
schema, | ||
uiSchema, | ||
} = formConfig.chapters.authorization.pages.authorizeOutsideVA; | ||
|
||
it('should render', () => { | ||
const { container } = render( | ||
<DefinitionTester | ||
definitions={{}} | ||
schema={schema} | ||
uiSchema={uiSchema} | ||
data={{}} | ||
formData={{}} | ||
/>, | ||
); | ||
|
||
expect($('button[type="submit"]', container)).to.exist; | ||
}); | ||
}); |
Oops, something went wrong.