Skip to content

Commit

Permalink
(safety) added null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mdewey committed Mar 6, 2024
1 parent 88fdd55 commit 7f7b365
Show file tree
Hide file tree
Showing 76 changed files with 7,673 additions and 7,673 deletions.
486 changes: 243 additions & 243 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

102 changes: 51 additions & 51 deletions src/applications/appeals/10182/containers/ConfirmationPage.jsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import React from 'react';

import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';

import ConfirmationDecisionReviews from '../../shared/components/ConfirmationDecisionReviews';

export const ConfirmationPage = () => (
<ConfirmationDecisionReviews
pageTitle="Request for Board Appeal"
alertTitle="We’ve received your Board Appeal request"
>
<h2 className="vads-u-font-size--h3">
After you request a decision review
</h2>
<p>
When we’ve completed your review, we will physically mail you a decision
packet that includes details about our decision.{' '}
<a href="/decision-reviews/after-you-request-review/">
Learn more about what happens after you request a review
</a>
.
</p>

<h2 className="vads-u-font-size--h3">What should I do while I wait?</h2>
<p>
You don’t need to do anything unless we send you a letter asking for more
information. If we schedule any exams for you, be sure not to miss them.
</p>
<p>
If you requested an appeal and haven’t heard back from us yet, please
don’t request another appeal. Call us at{' '}
<va-telephone contact={CONTACTS.VA_BENEFITS} /> (
<va-telephone contact={CONTACTS[711]} tty />
).
</p>
<br role="presentation" />
<a
href="/claim-or-appeal-status/"
className="vads-c-action-link--green"
aria-describedby="delay-note"
>
Check the status of your appeal
</a>
<p id="delay-note">
<strong>Note</strong>: It may take 7 to 10 days for your Board Appeal
request to appear online.
</p>
</ConfirmationDecisionReviews>
);

export default ConfirmationPage;
import React from 'react';

import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';

import ConfirmationDecisionReviews from '../../shared/components/ConfirmationDecisionReviews';

export const ConfirmationPage = () => (
<ConfirmationDecisionReviews
pageTitle="Request for Board Appeal"
alertTitle="We’ve received your Board Appeal request"
>
<h2 className="vads-u-font-size--h3">
After you request a decision review
</h2>
<p>
When we’ve completed your review, we will physically mail you a decision
packet that includes details about our decision.{' '}
<a href="/decision-reviews/after-you-request-review/">
Learn more about what happens after you request a review
</a>
.
</p>

<h2 className="vads-u-font-size--h3">What should I do while I wait?</h2>
<p>
You don’t need to do anything unless we send you a letter asking for more
information. If we schedule any exams for you, be sure not to miss them.
</p>
<p>
If you requested an appeal and haven’t heard back from us yet, please
don’t request another appeal. Call us at{' '}
<va-telephone contact={CONTACTS.VA_BENEFITS} /> (
<va-telephone contact={CONTACTS[711]} tty />
).
</p>
<br role="presentation" />
<a
href="/claim-or-appeal-status/"
className="vads-c-action-link--green"
aria-describedby="delay-note"
>
Check the status of your appeal
</a>
<p id="delay-note">
<strong>Note</strong>: It may take 7 to 10 days for your Board Appeal
request to appear online.
</p>
</ConfirmationDecisionReviews>
);

export default ConfirmationPage;
Original file line number Diff line number Diff line change
@@ -1,132 +1,132 @@
import React from 'react';
import { Provider } from 'react-redux';
import { render, waitFor } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { expect } from 'chai';
import moment from 'moment';

import { $, $$ } from 'platform/forms-system/src/js/utilities/ui';

import formConfig from '../../config/form';

import ConfirmationPage from '../../containers/ConfirmationPage';
import { SELECTED } from '../../../shared/constants';

const getData = ({ renderName = true, suffix = 'Esq.' } = {}) => ({
user: {
profile: {
userFullName: renderName
? { first: 'Foo', middle: 'Man', last: 'Choo', suffix }
: {},
},
},
form: {
formId: formConfig.formId,
submission: {
response: Date.now(),
},
data: {
contestedIssues: [
{
[SELECTED]: true,
attributes: {
ratingIssueSubjectText: 'test 543',
},
},
{
[SELECTED]: false,
attributes: {
ratingIssueSubjectText: 'test 987',
},
},
],
},
},
});

describe('Confirmation page', () => {
const middleware = [thunk];
const mockStore = configureStore(middleware);

it('should render the confirmation page', () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
expect($('va-alert[status="success"]', container)).to.exist;
expect($$('.dd-privacy-hidden[data-dd-action-name]').length).to.eq(2);
});
it('should render with no data', () => {
const { container } = render(
<Provider store={mockStore({})}>
<ConfirmationPage />
</Provider>,
);
expect($('va-alert[status="success"]', container)).to.exist;
});

it('should render the user name', () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
expect($('.dd-privacy-hidden', container).textContent).to.contain(
'Foo Man Choo, Esq.',
);
});
it('should render the user name without suffix', () => {
const { container } = render(
<Provider store={mockStore(getData({ suffix: '' }))}>
<ConfirmationPage />
</Provider>,
);
expect($('.dd-privacy-hidden', container).textContent).to.contain(
'Foo Man Choo',
);
});
it('should not render the user name', () => {
const { container } = render(
<Provider store={mockStore(getData({ renderName: false }))}>
<ConfirmationPage />
</Provider>,
);
expect($('[data-dd-action-name="Veteran full name"]', container)).to.not
.exist;
});

it('should render the submit date', () => {
const data = getData();
const date = moment(data.form.submission.response).format('MMMM D, YYYY');
const { container } = render(
<Provider store={mockStore(data)}>
<ConfirmationPage />
</Provider>,
);
expect($('va-summary-box', container).textContent).to.contain(date);
});
it('should render the selected contested issue', () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
const list = $('ul', container);
expect(list.textContent).to.contain('test 543');
expect(list.textContent).not.to.contain('test 987');
expect($$('span.dd-privacy-hidden', container).length).to.eq(1);
});
it('should focus on H2 inside va-alert', async () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
const h2 = $('va-alert h2', container);
await waitFor(() => {
expect(document.activeElement).to.eq(h2);
});
});
});
import React from 'react';
import { Provider } from 'react-redux';
import { render, waitFor } from '@testing-library/react';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import { expect } from 'chai';
import moment from 'moment';

import { $, $$ } from 'platform/forms-system/src/js/utilities/ui';

import formConfig from '../../config/form';

import ConfirmationPage from '../../containers/ConfirmationPage';
import { SELECTED } from '../../../shared/constants';

const getData = ({ renderName = true, suffix = 'Esq.' } = {}) => ({
user: {
profile: {
userFullName: renderName
? { first: 'Foo', middle: 'Man', last: 'Choo', suffix }
: {},
},
},
form: {
formId: formConfig.formId,
submission: {
response: Date.now(),
},
data: {
contestedIssues: [
{
[SELECTED]: true,
attributes: {
ratingIssueSubjectText: 'test 543',
},
},
{
[SELECTED]: false,
attributes: {
ratingIssueSubjectText: 'test 987',
},
},
],
},
},
});

describe('Confirmation page', () => {
const middleware = [thunk];
const mockStore = configureStore(middleware);

it('should render the confirmation page', () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
expect($('va-alert[status="success"]', container)).to.exist;
expect($$('.dd-privacy-hidden[data-dd-action-name]').length).to.eq(2);
});
it('should render with no data', () => {
const { container } = render(
<Provider store={mockStore({})}>
<ConfirmationPage />
</Provider>,
);
expect($('va-alert[status="success"]', container)).to.exist;
});

it('should render the user name', () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
expect($('.dd-privacy-hidden', container).textContent).to.contain(
'Foo Man Choo, Esq.',
);
});
it('should render the user name without suffix', () => {
const { container } = render(
<Provider store={mockStore(getData({ suffix: '' }))}>
<ConfirmationPage />
</Provider>,
);
expect($('.dd-privacy-hidden', container).textContent).to.contain(
'Foo Man Choo',
);
});
it('should not render the user name', () => {
const { container } = render(
<Provider store={mockStore(getData({ renderName: false }))}>
<ConfirmationPage />
</Provider>,
);
expect($('[data-dd-action-name="Veteran full name"]', container)).to.not
.exist;
});

it('should render the submit date', () => {
const data = getData();
const date = moment(data.form.submission.response).format('MMMM D, YYYY');
const { container } = render(
<Provider store={mockStore(data)}>
<ConfirmationPage />
</Provider>,
);
expect($('va-summary-box', container).textContent).to.contain(date);
});
it('should render the selected contested issue', () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
const list = $('ul', container);
expect(list.textContent).to.contain('test 543');
expect(list.textContent).not.to.contain('test 987');
expect($$('span.dd-privacy-hidden', container).length).to.eq(1);
});
it('should focus on H2 inside va-alert', async () => {
const { container } = render(
<Provider store={mockStore(getData())}>
<ConfirmationPage />
</Provider>,
);
const h2 = $('va-alert h2', container);
await waitFor(() => {
expect(document.activeElement).to.eq(h2);
});
});
});

0 comments on commit 7f7b365

Please sign in to comment.