It’s easy to upload the wrong file by mistake. We want to make sure
diff --git a/src/applications/caregivers/components/FormAlerts/GeneralErrorAlert.jsx b/src/applications/caregivers/components/FormAlerts/GeneralErrorAlert.jsx
new file mode 100644
index 000000000000..d649b5aaf90a
--- /dev/null
+++ b/src/applications/caregivers/components/FormAlerts/GeneralErrorAlert.jsx
@@ -0,0 +1,14 @@
+import React from 'react';
+
+const GeneralErrorAlert = () => (
+
+
+
Something went wrong
+
+ We’re sorry. Something went wrong on our end. Please try again later.
+
+ We can’t process your application unless you add a Family Caregiver.
+ Please go back and add either a Primary or Secondary Family Caregiver to
+ your application.
+
- We can’t process your application unless you add a Family Caregiver.
- Please go back and add either a Primary or Secondary Family Caregiver to
- your application.
-
Family caregivers are approved and designated by VA as Primary
diff --git a/src/applications/caregivers/components/FormDescriptions/SecondaryCaregiverDescription.jsx b/src/applications/caregivers/components/FormDescriptions/SecondaryCaregiverDescription.jsx
index 8842067e90fc..f44959d1a236 100644
--- a/src/applications/caregivers/components/FormDescriptions/SecondaryCaregiverDescription.jsx
+++ b/src/applications/caregivers/components/FormDescriptions/SecondaryCaregiverDescription.jsx
@@ -44,6 +44,7 @@ const SecondaryCaregiverDescription = ({
Family caregivers are approved and designated by VA as Primary
diff --git a/src/applications/caregivers/components/FormDescriptions/index.jsx b/src/applications/caregivers/components/FormDescriptions/index.jsx
index d10e0d6a8c25..f0049dc41e2e 100644
--- a/src/applications/caregivers/components/FormDescriptions/index.jsx
+++ b/src/applications/caregivers/components/FormDescriptions/index.jsx
@@ -42,6 +42,7 @@ export const HeathCareCoverageDescription = (
This information helps us determine if you may be eligible for health care
@@ -126,7 +127,10 @@ export const RepresentativeDescription = (
that proves you have this authority.
-
+
We can only accept a document that proves you have legal authority to make
decisions for the Veteran (such as a valid Power of Attorney, legal
guardianship order, or other legal document). We can’t accept a marriage
@@ -182,6 +186,7 @@ export const VeteranSSNDescription = (
We need the Veteran’s Social Security number or tax identification number to
process the application when it’s submitted online, but it’s not a
diff --git a/src/applications/caregivers/components/FormFields/AddressWithAutofill.jsx b/src/applications/caregivers/components/FormFields/AddressWithAutofill.jsx
index eb8b85326fd3..4f0195228290 100644
--- a/src/applications/caregivers/components/FormFields/AddressWithAutofill.jsx
+++ b/src/applications/caregivers/components/FormFields/AddressWithAutofill.jsx
@@ -132,6 +132,7 @@ const PrimaryAddressWithAutofill = props => {
checked={formData['view:autofill']}
label="Use the same address as the Veteran"
onVaChange={handleCheck}
+ uswds
/>
{
hint="This is the address where the Caregiver lives"
className="cg-address-input"
error={showError('street') || null}
- required
onInput={handleChange}
onBlur={handleBlur}
+ required
+ uswds
/>
{
className="cg-address-input"
onInput={handleChange}
onBlur={handleBlur}
+ uswds
/>
{
label="City"
className="cg-address-input"
error={showError('city') || null}
- required
onInput={handleChange}
onBlur={handleBlur}
+ required
+ uswds
/>
{
label="State"
className="cg-address-select"
error={showError('state') || null}
- required
onVaSelect={handleChange}
onBlur={handleBlur}
+ required
+ uswds
>
-
{constants.states.USA.map(state => (
You can use your Department of Defense benefits number (DBN) or your
diff --git a/src/applications/ezr/components/FormDescriptions/MaritalStatusDescription.jsx b/src/applications/ezr/components/FormDescriptions/MaritalStatusDescription.jsx
index 761732172517..1e03919ebd2f 100644
--- a/src/applications/ezr/components/FormDescriptions/MaritalStatusDescription.jsx
+++ b/src/applications/ezr/components/FormDescriptions/MaritalStatusDescription.jsx
@@ -4,6 +4,7 @@ const MaritalStatusDescription = (
-
+
>
);
};
diff --git a/src/applications/hca/components/FormAlerts/AuthenticatedShortFormAlert.jsx b/src/applications/hca/components/FormAlerts/AuthenticatedShortFormAlert.jsx
index ca7b19db4bfe..2c297742b2eb 100644
--- a/src/applications/hca/components/FormAlerts/AuthenticatedShortFormAlert.jsx
+++ b/src/applications/hca/components/FormAlerts/AuthenticatedShortFormAlert.jsx
@@ -1,12 +1,12 @@
import React, { useEffect } from 'react';
-import { connect } from 'react-redux';
-import PropTypes from 'prop-types';
+import { useSelector } from 'react-redux';
import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
import recordEvent from 'platform/monitoring/record-event';
-const AuthenticatedShortFormAlert = ({ formData }) => {
- const disabilityRating = formData['view:totalDisabilityRating'];
+const AuthenticatedShortFormAlert = () => {
+ const { data: formData } = useSelector(state => state.form);
+ const { 'view:totalDisabilityRating': disabilityRating } = formData;
// use logging to compare number of short forms started vs completed
useEffect(() => {
@@ -18,7 +18,7 @@ const AuthenticatedShortFormAlert = ({ formData }) => {
}, []);
return (
-
+
You can fill out a shorter application
Our records show that you have a{' '}
@@ -40,12 +40,4 @@ const AuthenticatedShortFormAlert = ({ formData }) => {
);
};
-AuthenticatedShortFormAlert.propTypes = {
- formData: PropTypes.object,
-};
-
-const mapStateToProps = state => ({
- formData: state.form.data,
-});
-
-export default connect(mapStateToProps)(AuthenticatedShortFormAlert);
+export default AuthenticatedShortFormAlert;
diff --git a/src/applications/hca/components/FormAlerts/DependentSIPWarning.jsx b/src/applications/hca/components/FormAlerts/DependentSIPWarning.jsx
index 8079c68557b6..d5501b63de86 100644
--- a/src/applications/hca/components/FormAlerts/DependentSIPWarning.jsx
+++ b/src/applications/hca/components/FormAlerts/DependentSIPWarning.jsx
@@ -3,9 +3,9 @@ import React from 'react';
const DependentSIPWarning = () => (
Be sure to enter all the required information for your dependent. We can
diff --git a/src/applications/hca/components/FormAlerts/DowntimeWarning.jsx b/src/applications/hca/components/FormAlerts/DowntimeWarning.jsx
index 21d638f93881..bb7f32006039 100644
--- a/src/applications/hca/components/FormAlerts/DowntimeWarning.jsx
+++ b/src/applications/hca/components/FormAlerts/DowntimeWarning.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
const DowntimeWarning = () => (
-
+
The health care application is down for maintenance
We’re sorry. The health care application is currently down while we fix a
diff --git a/src/applications/hca/components/FormAlerts/IdentityVerificationAlert.jsx b/src/applications/hca/components/FormAlerts/IdentityVerificationAlert.jsx
index 6cb0877a0525..f560ea030bd1 100644
--- a/src/applications/hca/components/FormAlerts/IdentityVerificationAlert.jsx
+++ b/src/applications/hca/components/FormAlerts/IdentityVerificationAlert.jsx
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
const IdentityVerificationAlert = ({ onVerify }) => (
-
+
Please verify your identity before applying for VA health care
We’re sorry for the interruption, but we’ve found some more information
@@ -10,7 +10,7 @@ const LoginRequiredAlert = ({ handleLogin }) => (
sign in to VA.gov to review. If you don’t have an account, you can create
one now.
+);
+
+export default CombatOperationServiceDescription;
diff --git a/src/applications/hca/components/FormDescriptions/DateRangeDescription.jsx b/src/applications/hca/components/FormDescriptions/DateRangeDescription.jsx
new file mode 100644
index 000000000000..31d32e37811e
--- /dev/null
+++ b/src/applications/hca/components/FormDescriptions/DateRangeDescription.jsx
@@ -0,0 +1,10 @@
+import React from 'react';
+
+const DateRangeDescription = (
+
+ You only need to enter one date range. We’ll use this information to find
+ your record.
+
+);
+
+export default DateRangeDescription;
diff --git a/src/applications/hca/components/FormDescriptions/GulfWarServiceDescription.jsx b/src/applications/hca/components/FormDescriptions/GulfWarServiceDescription.jsx
new file mode 100644
index 000000000000..d51328a503b3
--- /dev/null
+++ b/src/applications/hca/components/FormDescriptions/GulfWarServiceDescription.jsx
@@ -0,0 +1,32 @@
+import React from 'react';
+
+const GulfWarServiceDescription = (
+
+ It’s your choice whether you want to answer more questions about your
+ military service history and toxic exposure during your military service.
+ Before you decide, here’s what to know about how we’ll use this
+ information.
+
+
We use this information in these ways:
+
+
+ We’ll determine if you’re more likely to get VA health care benefits. We
+ call this “enhanced eligibility status.”
+
+
+ We’ll add information about your military service history and toxic
+ exposure to your VA medical record.
+
+
+
+
+ You may qualify for enhanced eligibility status if you receive any of
+ these benefits:
+
+
+
VA pension
+
VA service-connected disability compensation
+
Medicaid benefits
+
+
+ You may also qualify for enhanced eligibility status if you fit one of
+ these descriptions:
+
+
+
You’re a former Prisoner of War (POW).
+
You received a Purple Heart.
+
You received a Medal of Honor.
+
+ You served in Southwest Asia during the Gulf War between August 2,
+ 1990, and November 11, 1998.
+
+
+ You were exposed to toxins or hazards by working with chemicals,
+ pesticides, lead, asbestos, certain paints, nuclear weapons, x-rays,
+ or other toxins. This exposure could have happened while training or
+ serving on active duty, even if you were never deployed.
+
+
+ You served at least 30 days at Camp Lejeune between August 1, 1953,
+ and December 31, 1987.
+
+
+ You served in a location where you had exposure to Agent Orange during
+ the Vietnam War era.
+
@@ -510,6 +531,7 @@ export const EssentialCoverageDescription = (
To avoid the penalty for not having insurance, you must be enrolled in a
health plan that qualifies as minimum essential coverage. Being signed up
@@ -571,6 +593,7 @@ export const HealthInsuranceCoverageDescription = (
You can use your Department of Defense benefits number (DBN) or your
diff --git a/src/applications/hca/components/FormFields/DependentList.jsx b/src/applications/hca/components/FormFields/DependentList.jsx
index 207cf212dc43..5204d2315228 100644
--- a/src/applications/hca/components/FormFields/DependentList.jsx
+++ b/src/applications/hca/components/FormFields/DependentList.jsx
@@ -122,6 +122,7 @@ const DependentList = ({ labelledBy, list, mode, onDelete }) => {
className="fas fa-chevron-right vads-u-margin-left--0p5"
/>
+ {/* eslint-disable-next-line @department-of-veterans-affairs/prefer-button-component */}
-
+
);
};
diff --git a/src/applications/hca/components/FormPages/FinancialOnboarding.jsx b/src/applications/hca/components/FormPages/FinancialOnboarding.jsx
index 14fde2ce8c75..a0add6d7d34e 100644
--- a/src/applications/hca/components/FormPages/FinancialOnboarding.jsx
+++ b/src/applications/hca/components/FormPages/FinancialOnboarding.jsx
@@ -61,7 +61,10 @@ const HouseholdFinancialOnboarding = props => {
with the Internal Revenue Service (IRS).
-
+
You may qualify for enhanced eligibility status if you receive any
diff --git a/src/applications/hca/components/FormReview/DependentsReviewPage.jsx b/src/applications/hca/components/FormReview/DependentsReviewPage.jsx
index 7efc45b798f4..dee74d7133de 100644
--- a/src/applications/hca/components/FormReview/DependentsReviewPage.jsx
+++ b/src/applications/hca/components/FormReview/DependentsReviewPage.jsx
@@ -26,14 +26,13 @@ const DependentsReviewPage = ({ data, editPage }) => {
Make sure you meet our eligibility requirements for enrollment before
you apply.
@@ -20,7 +19,10 @@ const ProcessTimeline = () => (
text="Find out how to get mental health care"
/>
-
+
You may be eligible to enroll in VA health care if all of these
statements are true:
@@ -68,11 +70,9 @@ const ProcessTimeline = () => (
@@ -146,17 +146,14 @@ const ProcessTimeline = () => (
eligibility for VA health care.
-
+
-
-
-
Start your application
-
+
We’ll take you through each step of the process. It should take about
30 minutes.
-
+
We process health care applications within about a week. We’ll send
you a letter in the mail with our decision.
@@ -173,7 +170,7 @@ const ProcessTimeline = () => (
.
I understand that pursuant to 38 U.S.C. Section 1729 and 42 U.S.C.
@@ -110,6 +111,7 @@ const PreSubmitNotice = props => {
error={error}
onVaChange={event => setAccepted(event.target.checked)}
label="I confirm that I agree to the statements listed here. The information is true and correct to the best of my knowledge and belief. I’ve read and accept the privacy policy."
+ uswds
/>
>
);
diff --git a/src/applications/hca/components/VeteranInformation/AuthProfileInformation.jsx b/src/applications/hca/components/VeteranInformation/AuthProfileInformation.jsx
index dd6501fd24cc..8b3d48865e4c 100644
--- a/src/applications/hca/components/VeteranInformation/AuthProfileInformation.jsx
+++ b/src/applications/hca/components/VeteranInformation/AuthProfileInformation.jsx
@@ -16,8 +16,8 @@ const AuthProfileInformation = ({ user }) => {
? 'This is the personal information we have on file for you.'
: 'Here\u2019s the name we have on file for you.'}
-
-
+
+
Full name:
{
Confirm your information before you continue.
-
-
+
+
Full name:
!isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:healthInsuranceDescription': {
@@ -46,14 +44,14 @@ export default {
itemName: 'insurance policy',
hideTitle: true,
viewField: InsuranceProviderViewField,
- itemAriaLabel: formData => getInsuranceAriaLabel(formData),
+ itemAriaLabel: getInsuranceAriaLabel,
},
'ui:errorMessages': {
minItems: 'You need to at least one provider.',
},
items: {
'ui:options': {
- itemAriaLabel: formData => getInsuranceAriaLabel(formData),
+ itemAriaLabel: getInsuranceAriaLabel,
},
insuranceName: {
'ui:title': 'Name of insurance provider',
diff --git a/src/applications/hca/config/chapters/insuranceInformation/medicaid.js b/src/applications/hca/config/chapters/insuranceInformation/medicaid.js
index dbc7459c3734..23a8965ca73b 100644
--- a/src/applications/hca/config/chapters/insuranceInformation/medicaid.js
+++ b/src/applications/hca/config/chapters/insuranceInformation/medicaid.js
@@ -1,7 +1,7 @@
import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
import { MedicaidDescription } from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { isMedicaidEligible } = fullSchemaHca.properties;
@@ -11,7 +11,7 @@ export default {
'view:medicaidShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:medicaidDescription': {
diff --git a/src/applications/hca/config/chapters/insuranceInformation/vaFacility_api.js b/src/applications/hca/config/chapters/insuranceInformation/vaFacility_api.js
index 1be6f3237f6f..ffdef2255c5d 100644
--- a/src/applications/hca/config/chapters/insuranceInformation/vaFacility_api.js
+++ b/src/applications/hca/config/chapters/insuranceInformation/vaFacility_api.js
@@ -7,7 +7,7 @@ import {
} from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
import VaMedicalCenter from '../../../components/FormFields/VaMedicalCenter';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
// define default schema properties
@@ -26,7 +26,7 @@ export default {
'view:facilityShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:vaFacilityTitle': {
@@ -43,12 +43,10 @@ export default {
'ui:title': 'Select your preferred VA medical facility',
'view:facilityState': {
'ui:title': 'State',
- 'ui:required': () => true,
},
vaMedicalFacility: {
'ui:title': 'Center or clinic',
'ui:widget': VaMedicalCenter,
- 'ui:required': () => true,
'ui:options': {
hideLabelText: true,
},
@@ -72,6 +70,7 @@ export default {
'view:isEssentialCoverageDesc': emptyObjectSchema,
'view:preferredFacility': {
type: 'object',
+ required: ['view:facilityState', 'vaMedicalFacility'],
properties: {
'view:facilityState': {
type: 'string',
diff --git a/src/applications/hca/config/chapters/insuranceInformation/vaFacility_json.js b/src/applications/hca/config/chapters/insuranceInformation/vaFacility_json.js
index a21bb14fdc9a..5022acdac2b9 100644
--- a/src/applications/hca/config/chapters/insuranceInformation/vaFacility_json.js
+++ b/src/applications/hca/config/chapters/insuranceInformation/vaFacility_json.js
@@ -9,10 +9,8 @@ import {
FacilityLocatorDescription,
} from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import {
- medicalCentersByState,
- isShortFormEligible,
-} from '../../../utils/helpers';
+import { medicalCentersByState } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const {
@@ -28,7 +26,7 @@ export default {
'view:facilityShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:vaFacilityTitle': {
diff --git a/src/applications/hca/config/chapters/militaryService/additionalInformation.js b/src/applications/hca/config/chapters/militaryService/additionalInformation.js
index 30b0c2682727..1218ffbb82b2 100644
--- a/src/applications/hca/config/chapters/militaryService/additionalInformation.js
+++ b/src/applications/hca/config/chapters/militaryService/additionalInformation.js
@@ -1,6 +1,7 @@
import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
import MilitaryPrefillMessage from 'platform/forms/save-in-progress/MilitaryPrefillMessage';
-import { ServiceHistoryTitle } from '../../../components/FormDescriptions';
+import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
+import { teraInformationEnabled } from '../../../utils/helpers/form-config';
const {
campLejeune,
@@ -16,53 +17,73 @@ const {
export default {
uiSchema: {
- 'ui:title': ServiceHistoryTitle,
+ ...titleUI('Service history', 'Check all that apply to you.'),
'ui:description': MilitaryPrefillMessage,
- purpleHeartRecipient: {
- 'ui:title': 'Purple Heart award recipient',
- },
- isFormerPow: {
- 'ui:title': 'Former Prisoner of War',
- },
- postNov111998Combat: {
- 'ui:title':
- 'Served in combat theater of operations after November 11, 1998',
- },
- disabledInLineOfDuty: {
- 'ui:title':
- 'Discharged or retired from the military for a disability incurred in the line of duty',
- },
- swAsiaCombat: {
- 'ui:title':
- 'Served in Southwest Asia during the Gulf War between August 2, 1990, and Nov 11, 1998',
- },
- vietnamService: {
- 'ui:title': 'Served in Vietnam between January 9, 1962, and May 7, 1975',
- },
- exposedToRadiation: {
- 'ui:title': 'Exposed to radiation while in the military',
- },
- radiumTreatments: {
- 'ui:title':
- 'Received nose/throat radium treatments while in the military',
- },
- campLejeune: {
- 'ui:title':
- 'Served on active duty at least 30 days at Camp Lejeune from January 1, 1953, through December 31, 1987',
+ 'view:serviceHistory': {
+ purpleHeartRecipient: {
+ 'ui:title': 'Purple Heart award recipient',
+ },
+ isFormerPow: {
+ 'ui:title': 'Former Prisoner of War',
+ },
+ postNov111998Combat: {
+ 'ui:title':
+ 'Served in combat theater of operations after November 11, 1998',
+ },
+ disabledInLineOfDuty: {
+ 'ui:title':
+ 'Discharged or retired from the military for a disability incurred in the line of duty',
+ },
+ swAsiaCombat: {
+ 'ui:title':
+ 'Served in Southwest Asia during the Gulf War between August 2, 1990, and November 11, 1998',
+ },
+ vietnamService: {
+ 'ui:title':
+ 'Served in Vietnam between January 9, 1962, and May 7, 1975',
+ 'ui:options': {
+ hideIf: teraInformationEnabled,
+ },
+ },
+ exposedToRadiation: {
+ 'ui:title': 'Exposed to radiation while in the military',
+ 'ui:options': {
+ hideIf: teraInformationEnabled,
+ },
+ },
+ radiumTreatments: {
+ 'ui:title':
+ 'Received nose/throat radium treatments while in the military',
+ 'ui:options': {
+ hideIf: teraInformationEnabled,
+ },
+ },
+ campLejeune: {
+ 'ui:title':
+ 'Served on active duty at least 30 days at Camp Lejeune from January 1, 1953, through December 31, 1987',
+ 'ui:options': {
+ hideIf: teraInformationEnabled,
+ },
+ },
},
},
schema: {
type: 'object',
properties: {
- purpleHeartRecipient,
- isFormerPow,
- postNov111998Combat,
- disabledInLineOfDuty,
- swAsiaCombat,
- vietnamService,
- exposedToRadiation,
- radiumTreatments,
- campLejeune,
+ 'view:serviceHistory': {
+ type: 'object',
+ properties: {
+ purpleHeartRecipient,
+ isFormerPow,
+ postNov111998Combat,
+ disabledInLineOfDuty,
+ swAsiaCombat,
+ vietnamService,
+ exposedToRadiation,
+ radiumTreatments,
+ campLejeune,
+ },
+ },
},
},
};
diff --git a/src/applications/hca/config/chapters/militaryService/agentOrangeExposure.js b/src/applications/hca/config/chapters/militaryService/agentOrangeExposure.js
new file mode 100644
index 000000000000..fb122b76d703
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/agentOrangeExposure.js
@@ -0,0 +1,22 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import AgentOrangeExposureDescription from '../../../components/FormDescriptions/AgentOrangeExposureDescription';
+
+const { exposedToAgentOrange } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ 'ui:title': 'Agent Orange locations',
+ exposedToAgentOrange: {
+ 'ui:title':
+ 'Did you serve in any of these locations where the military used the herbicide Agent Orange?',
+ 'ui:description': AgentOrangeExposureDescription,
+ 'ui:widget': 'yesNo',
+ },
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ exposedToAgentOrange,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/combatOperationService.js b/src/applications/hca/config/chapters/militaryService/combatOperationService.js
new file mode 100644
index 000000000000..125dce011ebf
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/combatOperationService.js
@@ -0,0 +1,21 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import CombatOperationServiceDescription from '../../../components/FormDescriptions/CombatOperationServiceDescription';
+
+const { combatOperationService } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ 'ui:title': 'Operations',
+ combatOperationService: {
+ 'ui:title': 'Were you deployed in support of any of these operations?',
+ 'ui:description': CombatOperationServiceDescription,
+ 'ui:widget': 'yesNo',
+ },
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ combatOperationService,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/documentUpload.js b/src/applications/hca/config/chapters/militaryService/documentUpload.js
index 3fdeded40cf4..482ff663c9a7 100644
--- a/src/applications/hca/config/chapters/militaryService/documentUpload.js
+++ b/src/applications/hca/config/chapters/militaryService/documentUpload.js
@@ -1,40 +1,7 @@
import environment from 'platform/utilities/environment';
import fileUploadUI from 'platform/forms-system/src/js/definitions/file';
-
import DischargePapersDescription from '../../../components/FormDescriptions/DischargePapersDescription';
-
-const attachmentsSchema = {
- type: 'array',
- minItems: 1,
- items: {
- type: 'object',
- required: ['attachmentId', 'name'],
- properties: {
- name: {
- type: 'string',
- },
- size: {
- type: 'integer',
- },
- confirmationCode: {
- type: 'string',
- },
- attachmentId: {
- type: 'string',
- enum: ['1', '2', '3', '4', '5', '6', '7'],
- enumNames: [
- 'DD214',
- 'DD215 (used to correct or make additions to the DD214)',
- 'WD AGO 53-55 (report of separation used prior to 1950)',
- 'Other discharge papers (like your DD256, DD257, or NGB22)',
- 'Official documentation of a military award (like a Purple Heart, Medal of Honor, or Silver Star)',
- 'Disability rating letter from the Veterans Benefit Administration (VBA)',
- 'Other official military document',
- ],
- },
- },
- },
-};
+import { attachmentsSchema } from '../../../definitions/attachments';
export default {
uiSchema: {
diff --git a/src/applications/hca/config/chapters/militaryService/gulfWarService.js b/src/applications/hca/config/chapters/militaryService/gulfWarService.js
new file mode 100644
index 000000000000..555e3647ada0
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/gulfWarService.js
@@ -0,0 +1,21 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import GulfWarServiceDescription from '../../../components/FormDescriptions/GulfWarServiceDescription';
+
+const { gulfWarService } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ 'ui:title': 'Gulf War locations',
+ gulfWarService: {
+ 'ui:title': 'Did you serve in any of these Gulf War locations?',
+ 'ui:description': GulfWarServiceDescription,
+ 'ui:widget': 'yesNo',
+ },
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ gulfWarService,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/gulfWarServiceDates.js b/src/applications/hca/config/chapters/militaryService/gulfWarServiceDates.js
new file mode 100644
index 000000000000..2e3ce8b9e8c3
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/gulfWarServiceDates.js
@@ -0,0 +1,45 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
+import currentOrPastMonthYearUI from 'platform/forms-system/src/js/definitions/currentOrPastMonthYear';
+import { ServiceDateRangeDescription } from '../../../components/FormDescriptions';
+import DateRangeDescription from '../../../components/FormDescriptions/DateRangeDescription';
+import { validateGulfWarDates } from '../../../utils/validation';
+import { emptyObjectSchema } from '../../../definitions';
+
+const { gulfWarStartDate, gulfWarEndDate } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ ...titleUI(
+ 'Service dates for Gulf War locations',
+ 'Enter any date range you served in a Gulf War location. You don\u2019t need to have exact dates.',
+ ),
+ 'view:gulfWarServiceDates': {
+ gulfWarStartDate: {
+ ...currentOrPastMonthYearUI('Service start date'),
+ 'ui:description': ServiceDateRangeDescription,
+ },
+ gulfWarEndDate: {
+ ...currentOrPastMonthYearUI('Service end date'),
+ 'ui:description': ServiceDateRangeDescription,
+ },
+ },
+ 'view:dateRange': {
+ 'ui:description': DateRangeDescription,
+ },
+ 'ui:validations': [validateGulfWarDates],
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ 'view:gulfWarServiceDates': {
+ type: 'object',
+ properties: {
+ gulfWarStartDate,
+ gulfWarEndDate,
+ },
+ },
+ 'view:dateRange': emptyObjectSchema,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/otherToxicExposure.js b/src/applications/hca/config/chapters/militaryService/otherToxicExposure.js
new file mode 100644
index 000000000000..4b3b7c685e31
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/otherToxicExposure.js
@@ -0,0 +1,80 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
+
+const {
+ exposureToAirPollutants,
+ exposureToAsbestos,
+ exposureToChemicals,
+ exposureToContaminatedWater,
+ exposureToMustardGas,
+ exposureToOccupationalHazards,
+ exposureToRadiation,
+ exposureToShad,
+ exposureToWarfareAgents,
+ exposureToOther,
+} = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ ...titleUI(
+ 'Other toxic exposures',
+ 'Have you been exposed to any of these toxins or hazards? Check any that you\u2019ve been exposed to.',
+ ),
+ 'view:otherToxicExposures': {
+ exposureToAirPollutants: {
+ 'ui:title':
+ 'Air pollutants (like burn pits, sand, oil wells, or sulfur fires)',
+ },
+ exposureToAsbestos: {
+ 'ui:title': 'Asbestos',
+ },
+ exposureToChemicals: {
+ 'ui:title':
+ 'Chemicals (like pesticides, herbicides, or contaminated water)',
+ },
+ exposureToContaminatedWater: {
+ 'ui:title': 'Contaminated Water at Camp Lejeune',
+ },
+ exposureToMustardGas: {
+ 'ui:title': 'Mustard gas',
+ },
+ exposureToOccupationalHazards: {
+ 'ui:title':
+ 'Occupational hazards (jet fuel, industrial solvents, lead, firefighting foams)',
+ },
+ exposureToRadiation: {
+ 'ui:title': 'Radiation',
+ },
+ exposureToShad: {
+ 'ui:title': 'SHAD (Shipboard Hazard and Defense)',
+ },
+ exposureToWarfareAgents: {
+ 'ui:title':
+ 'Warfare agents (like nerve agents or chemical and biological weapons)',
+ },
+ exposureToOther: {
+ 'ui:title': 'Other toxins or hazards not listed here',
+ },
+ },
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ 'view:otherToxicExposures': {
+ type: 'object',
+ properties: {
+ exposureToAirPollutants,
+ exposureToAsbestos,
+ exposureToChemicals,
+ exposureToContaminatedWater,
+ exposureToMustardGas,
+ exposureToOccupationalHazards,
+ exposureToRadiation,
+ exposureToShad,
+ exposureToWarfareAgents,
+ exposureToOther,
+ },
+ },
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/otherToxicExposureDates.js b/src/applications/hca/config/chapters/militaryService/otherToxicExposureDates.js
new file mode 100644
index 000000000000..d335aa69aaa7
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/otherToxicExposureDates.js
@@ -0,0 +1,48 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
+import currentOrPastMonthYearUI from 'platform/forms-system/src/js/definitions/currentOrPastMonthYear';
+import { ServiceDateRangeDescription } from '../../../components/FormDescriptions';
+import DateRangeDescription from '../../../components/FormDescriptions/DateRangeDescription';
+import { validateExposureDates } from '../../../utils/validation';
+import { emptyObjectSchema } from '../../../definitions';
+
+const {
+ toxicExposureStartDate,
+ toxicExposureEndDate,
+} = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ ...titleUI(
+ 'Dates of exposure',
+ 'Enter any date range when you were exposed to other toxic hazards or substances. You don\u2019t need to have exact dates.',
+ ),
+ 'view:toxicExposureDates': {
+ toxicExposureStartDate: {
+ ...currentOrPastMonthYearUI('Exposure start date'),
+ 'ui:description': ServiceDateRangeDescription,
+ },
+ toxicExposureEndDate: {
+ ...currentOrPastMonthYearUI('Exposure end date'),
+ 'ui:description': ServiceDateRangeDescription,
+ },
+ },
+ 'view:dateRange': {
+ 'ui:description': DateRangeDescription,
+ },
+ 'ui:validations': [validateExposureDates],
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ 'view:toxicExposureDates': {
+ type: 'object',
+ properties: {
+ toxicExposureStartDate,
+ toxicExposureEndDate,
+ },
+ },
+ 'view:dateRange': emptyObjectSchema,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/otherToxicExposureDetails.js b/src/applications/hca/config/chapters/militaryService/otherToxicExposureDetails.js
new file mode 100644
index 000000000000..5cd0e70e92ae
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/otherToxicExposureDetails.js
@@ -0,0 +1,27 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import { titleUI } from 'platform/forms-system/src/js/web-component-patterns';
+import { OtherToxicExposureDescription } from '../../../components/FormDescriptions';
+
+const { otherToxicExposure } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ ...titleUI(
+ 'Other toxic exposure',
+ 'You selected that you were exposed to other toxins or hazards.',
+ ),
+ 'ui:description': OtherToxicExposureDescription,
+ otherToxicExposure: {
+ 'ui:title': 'Enter any toxins or hazards you\u2019ve been exposed to',
+ 'ui:errorMessages': {
+ pattern: 'Please enter a valid toxin or hazard',
+ },
+ },
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ otherToxicExposure,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/radiationCleanup.js b/src/applications/hca/config/chapters/militaryService/radiationCleanup.js
new file mode 100644
index 000000000000..648de596f522
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/radiationCleanup.js
@@ -0,0 +1,22 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import RadiationCleanupDescription from '../../../components/FormDescriptions/RadiationCleanupDescription';
+
+const { radiationCleanupEfforts } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ 'ui:title': 'Cleanup or response efforts',
+ radiationCleanupEfforts: {
+ 'ui:title':
+ 'Did you take part in any of these cleanup or response efforts?',
+ 'ui:description': RadiationCleanupDescription,
+ 'ui:widget': 'yesNo',
+ },
+ },
+ schema: {
+ type: 'object',
+ properties: {
+ radiationCleanupEfforts,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/militaryService/serviceInformation.js b/src/applications/hca/config/chapters/militaryService/serviceInformation.js
index 2ad79ac90faa..2500485adf4b 100644
--- a/src/applications/hca/config/chapters/militaryService/serviceInformation.js
+++ b/src/applications/hca/config/chapters/militaryService/serviceInformation.js
@@ -25,8 +25,6 @@ export default {
labels: SERVICE_BRANCH_LABELS,
},
},
- // TODO: this should really be a dateRange, but that requires a backend schema change. For now
- // leaving them as dates, but should change these to get the proper dateRange validation
lastEntryDate: currentOrPastDateUI('Service start date'),
lastDischargeDate: dateUI('Service end date'),
dischargeType: {
diff --git a/src/applications/hca/config/chapters/militaryService/toxicExposure.js b/src/applications/hca/config/chapters/militaryService/toxicExposure.js
new file mode 100644
index 000000000000..eea3552f2787
--- /dev/null
+++ b/src/applications/hca/config/chapters/militaryService/toxicExposure.js
@@ -0,0 +1,23 @@
+import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
+import ToxicExposureDescription from '../../../components/FormDescriptions/ToxicExposureDescription';
+
+const { hasTeraResponse } = fullSchemaHca.properties;
+
+export default {
+ uiSchema: {
+ 'ui:title': 'Toxic exposure',
+ 'ui:description': ToxicExposureDescription,
+ hasTeraResponse: {
+ 'ui:title':
+ 'Do you want to answer questions about your military service history and toxic exposure?',
+ 'ui:widget': 'yesNo',
+ },
+ },
+ schema: {
+ type: 'object',
+ required: ['hasTeraResponse'],
+ properties: {
+ hasTeraResponse,
+ },
+ },
+};
diff --git a/src/applications/hca/config/chapters/veteranInformation/birthInformation.js b/src/applications/hca/config/chapters/veteranInformation/birthInformation.js
index 40015a28a5c8..cd3270c9b62e 100644
--- a/src/applications/hca/config/chapters/veteranInformation/birthInformation.js
+++ b/src/applications/hca/config/chapters/veteranInformation/birthInformation.js
@@ -3,7 +3,7 @@ import constants from 'vets-json-schema/dist/constants.json';
import AuthenticatedShortFormAlert from '../../../components/FormAlerts/AuthenticatedShortFormAlert';
import { BirthInfoDescription } from '../../../components/FormDescriptions';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { cityOfBirth } = fullSchemaHca.properties;
@@ -12,9 +12,9 @@ const { states50AndDC } = constants;
export default {
uiSchema: {
'view:authShortFormAlert': {
- 'ui:field': AuthenticatedShortFormAlert,
+ 'ui:description': AuthenticatedShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:placeOfBirth': {
diff --git a/src/applications/hca/config/chapters/veteranInformation/birthSex.js b/src/applications/hca/config/chapters/veteranInformation/birthSex.js
index 0ce7fd57524c..43827d91b30f 100644
--- a/src/applications/hca/config/chapters/veteranInformation/birthSex.js
+++ b/src/applications/hca/config/chapters/veteranInformation/birthSex.js
@@ -3,7 +3,7 @@ import PrefillMessage from 'platform/forms/save-in-progress/PrefillMessage';
import { genderLabels } from 'platform/static-data/labels';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { gender } = fullSchemaHca.properties;
@@ -13,7 +13,7 @@ export default {
'view:birthSexShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:prefillMessage': {
diff --git a/src/applications/hca/config/chapters/veteranInformation/contactInformation.js b/src/applications/hca/config/chapters/veteranInformation/contactInformation.js
index 924a6c2b0d1b..37c19a4c050c 100644
--- a/src/applications/hca/config/chapters/veteranInformation/contactInformation.js
+++ b/src/applications/hca/config/chapters/veteranInformation/contactInformation.js
@@ -5,7 +5,7 @@ import PrefillMessage from 'platform/forms/save-in-progress/PrefillMessage';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
import { ContactInfoDescription } from '../../../components/FormDescriptions';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { email, homePhone, mobilePhone } = fullSchemaHca.properties;
@@ -15,7 +15,7 @@ export default {
'view:contactShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:prefillMessage': {
diff --git a/src/applications/hca/config/chapters/veteranInformation/demographicInformation.js b/src/applications/hca/config/chapters/veteranInformation/demographicInformation.js
index cd34f20470b4..11849f37cfa7 100644
--- a/src/applications/hca/config/chapters/veteranInformation/demographicInformation.js
+++ b/src/applications/hca/config/chapters/veteranInformation/demographicInformation.js
@@ -4,7 +4,7 @@ import PrefillMessage from 'platform/forms/save-in-progress/PrefillMessage';
import DemographicField from '../../../components/FormFields/DemographicViewField';
import { DemographicInfoDescription } from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const {
@@ -22,7 +22,7 @@ export default {
'view:dmShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:prefillMessage': {
diff --git a/src/applications/hca/config/chapters/veteranInformation/maidenNameInformation.js b/src/applications/hca/config/chapters/veteranInformation/maidenNameInformation.js
index 1dd996e86a2f..adc65e2fcff3 100644
--- a/src/applications/hca/config/chapters/veteranInformation/maidenNameInformation.js
+++ b/src/applications/hca/config/chapters/veteranInformation/maidenNameInformation.js
@@ -2,7 +2,7 @@ import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
import set from 'platform/utilities/data/set';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { mothersMaidenName } = fullSchemaHca.properties;
@@ -12,7 +12,7 @@ export default {
'view:maidenNameShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
mothersMaidenName: {
diff --git a/src/applications/hca/config/chapters/veteranInformation/veteranAddress.js b/src/applications/hca/config/chapters/veteranInformation/veteranAddress.js
index 270d98ea19b9..5a15fdead80a 100644
--- a/src/applications/hca/config/chapters/veteranInformation/veteranAddress.js
+++ b/src/applications/hca/config/chapters/veteranInformation/veteranAddress.js
@@ -8,7 +8,7 @@ import {
import { MailingAddressDescription } from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { veteranAddress: address } = fullSchemaHca.properties;
@@ -18,7 +18,7 @@ export default {
'view:veteranAddressShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:prefillMessage': {
diff --git a/src/applications/hca/config/chapters/veteranInformation/veteranGender.js b/src/applications/hca/config/chapters/veteranInformation/veteranGender.js
index fd43beedf978..1416ee3c1b26 100644
--- a/src/applications/hca/config/chapters/veteranInformation/veteranGender.js
+++ b/src/applications/hca/config/chapters/veteranInformation/veteranGender.js
@@ -3,7 +3,7 @@ import PrefillMessage from 'platform/forms/save-in-progress/PrefillMessage';
import { SIGIGenderDescription } from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { sigiGenders } = fullSchemaHca.properties;
@@ -13,7 +13,7 @@ export default {
'view:genderShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:prefillMessage': {
diff --git a/src/applications/hca/config/chapters/veteranInformation/veteranHomeAddress.js b/src/applications/hca/config/chapters/veteranInformation/veteranHomeAddress.js
index 8f226513ad1c..6dda572a9e1c 100644
--- a/src/applications/hca/config/chapters/veteranInformation/veteranHomeAddress.js
+++ b/src/applications/hca/config/chapters/veteranInformation/veteranHomeAddress.js
@@ -8,7 +8,7 @@ import {
import { HomeAddressDescription } from '../../../components/FormDescriptions';
import ShortFormAlert from '../../../components/FormAlerts/ShortFormAlert';
-import { isShortFormEligible } from '../../../utils/helpers';
+import { notShortFormEligible } from '../../../utils/helpers/form-config';
import { emptyObjectSchema } from '../../../definitions';
const { veteranHomeAddress: address } = fullSchemaHca.properties;
@@ -18,7 +18,7 @@ export default {
'view:homeAddressShortFormMessage': {
'ui:description': ShortFormAlert,
'ui:options': {
- hideIf: formData => !isShortFormEligible(formData),
+ hideIf: notShortFormEligible,
},
},
'view:prefillMessage': {
diff --git a/src/applications/hca/config/form.js b/src/applications/hca/config/form.js
index b3874bc044cf..2c77312b73ea 100644
--- a/src/applications/hca/config/form.js
+++ b/src/applications/hca/config/form.js
@@ -5,13 +5,33 @@ import { VA_FORM_IDS } from 'platform/forms/constants';
import { externalServices } from 'platform/monitoring/DowntimeNotification';
// HCA internal app imports
+import { prefillTransformer, transform } from '../utils/helpers';
import {
- prefillTransformer,
- transform,
- isShortFormEligible,
+ isLoggedOut,
+ isSigiEnabled,
+ isMissingVeteranDob,
+ hasDifferentHomeAddress,
+ hasLowDisabilityRating,
+ hasNoCompensation,
+ hasHighCompensation,
+ notShortFormEligible,
+ dischargePapersRequired,
+ teraInformationEnabled,
+ includeTeraInformation,
+ includeGulfWarServiceDates,
+ includeOtherExposureDates,
+ includeOtherExposureDetails,
+ showFinancialConfirmation,
+ includeHouseholdInformation,
includeSpousalInformation,
-} from '../utils/helpers';
-import { HIGH_DISABILITY_MINIMUM, SHARED_PATHS } from '../utils/constants';
+ spouseDidNotCohabitateWithVeteran,
+ spouseAddressDoesNotMatchVeterans,
+ includeDependentInformation,
+ collectMedicareInformation,
+ useJsonFacilityList,
+ useLighthouseFacilityList,
+} from '../utils/helpers/form-config';
+import { SHARED_PATHS } from '../utils/constants';
import migrations from './migrations';
import manifest from '../manifest.json';
import IdentityPage from '../containers/IdentityPage';
@@ -35,17 +55,26 @@ import veteranGender from './chapters/veteranInformation/veteranGender';
import veteranHomeAddress from './chapters/veteranInformation/veteranHomeAddress';
import contactInformation from './chapters/veteranInformation/contactInformation';
-// chapter 2 Military Service
-import serviceInformation from './chapters/militaryService/serviceInformation';
-import additionalInformation from './chapters/militaryService/additionalInformation';
-import documentUpload from './chapters/militaryService/documentUpload';
-
-// chapter 3 VA Benefits
+// chapter 2 VA Benefits
import basicInformation from './chapters/vaBenefits/basicInformation';
import pensionInformation from './chapters/vaBenefits/pensionInformation';
import DisabilityConfirmationPage from '../components/FormPages/DisabilityConfirmation';
import CompensationTypeReviewPage from '../components/FormReview/CompensationTypeReviewPage';
+// chapter 3 Military Service
+import serviceInformation from './chapters/militaryService/serviceInformation';
+import additionalInformation from './chapters/militaryService/additionalInformation';
+import toxicExposure from './chapters/militaryService/toxicExposure';
+import radiationCleanup from './chapters/militaryService/radiationCleanup';
+import gulfWarService from './chapters/militaryService/gulfWarService';
+import gulfWarServiceDates from './chapters/militaryService/gulfWarServiceDates';
+import combatOperationService from './chapters/militaryService/combatOperationService';
+import agentOrangeExposure from './chapters/militaryService/agentOrangeExposure';
+import otherToxicExposure from './chapters/militaryService/otherToxicExposure';
+import otherToxicExposureDetails from './chapters/militaryService/otherToxicExposureDetails';
+import otherToxicExposureDates from './chapters/militaryService/otherToxicExposureDates';
+import documentUpload from './chapters/militaryService/documentUpload';
+
// chapter 4 Household Information
import FinancialDisclosure from './chapters/householdInformation/financialDisclosure';
import MaritalStatus from './chapters/householdInformation/maritalStatus';
@@ -116,7 +145,7 @@ const formConfig = {
path: 'id-form',
component: IdentityPage,
pageKey: 'id-form',
- depends: formData => !formData['view:isLoggedIn'],
+ depends: isLoggedOut,
},
],
confirmation: ConfirmationPage,
@@ -147,8 +176,7 @@ const formConfig = {
path: 'veteran-information/profile-information-dob',
title: 'Date of birth',
initialData: {},
- depends: formData =>
- formData['view:isLoggedIn'] && !formData['view:userDob'],
+ depends: isMissingVeteranDob,
uiSchema: veteranDateOfBirth.uiSchema,
schema: veteranDateOfBirth.schema,
},
@@ -177,7 +205,7 @@ const formConfig = {
path: 'veteran-information/veteran-gender',
title: 'Gender',
initialData: {},
- depends: formData => formData['view:isSigiEnabled'],
+ depends: isSigiEnabled,
uiSchema: veteranGender.uiSchema,
schema: veteranGender.schema,
},
@@ -203,7 +231,7 @@ const formConfig = {
path: 'veteran-information/veteran-home-address',
title: 'Home address',
initialData: {},
- depends: formData => !formData['view:doesMailingMatchHomeAddress'],
+ depends: hasDifferentHomeAddress,
uiSchema: veteranHomeAddress.uiSchema,
schema: veteranHomeAddress.schema,
},
@@ -222,8 +250,7 @@ const formConfig = {
vaBenefits: {
path: 'va-benefits/basic-information',
title: 'VA benefits',
- depends: formData =>
- formData['view:totalDisabilityRating'] < HIGH_DISABILITY_MINIMUM,
+ depends: hasLowDisabilityRating,
CustomPageReview: CompensationTypeReviewPage,
uiSchema: basicInformation.uiSchema,
schema: basicInformation.schema,
@@ -232,7 +259,7 @@ const formConfig = {
path: 'va-benefits/confirm-service-pay',
title: 'Disability confirmation',
initialData: {},
- depends: formData => formData.vaCompensationType === 'highDisability',
+ depends: hasHighCompensation,
CustomPage: DisabilityConfirmationPage,
CustomPageReview: null,
uiSchema: {},
@@ -241,7 +268,7 @@ const formConfig = {
vaPension: {
path: 'va-benefits/pension-information',
title: 'VA pension',
- depends: formData => formData.vaCompensationType === 'none',
+ depends: hasNoCompensation,
uiSchema: pensionInformation.uiSchema,
schema: pensionInformation.schema,
},
@@ -253,22 +280,84 @@ const formConfig = {
serviceInformation: {
path: 'military-service/service-information',
title: 'Service periods',
- depends: formData => !isShortFormEligible(formData),
+ depends: notShortFormEligible,
uiSchema: serviceInformation.uiSchema,
schema: serviceInformation.schema,
},
additionalInformation: {
path: 'military-service/additional-information',
title: 'Service history',
- depends: formData => !isShortFormEligible(formData),
+ depends: notShortFormEligible,
uiSchema: additionalInformation.uiSchema,
schema: additionalInformation.schema,
},
+ toxicExposure: {
+ path: 'military-service/toxic-exposure',
+ title: 'Toxic exposure',
+ depends: teraInformationEnabled,
+ uiSchema: toxicExposure.uiSchema,
+ schema: toxicExposure.schema,
+ },
+ radiationCleanup: {
+ path: 'military-service/radiation-cleanup-efforts',
+ title: 'Radiation cleanup or response efforts',
+ depends: includeTeraInformation,
+ uiSchema: radiationCleanup.uiSchema,
+ schema: radiationCleanup.schema,
+ },
+ gulfWarService: {
+ path: 'military-service/gulf-war-service',
+ title: 'Gulf War service locations',
+ depends: includeTeraInformation,
+ uiSchema: gulfWarService.uiSchema,
+ schema: gulfWarService.schema,
+ },
+ gulfWarServiceDates: {
+ path: 'military-service/gulf-war-service-dates',
+ title: 'Gulf War service dates',
+ depends: includeGulfWarServiceDates,
+ uiSchema: gulfWarServiceDates.uiSchema,
+ schema: gulfWarServiceDates.schema,
+ },
+ combatOperationService: {
+ path: 'military-service/operation-support',
+ title: 'Operations',
+ depends: includeTeraInformation,
+ uiSchema: combatOperationService.uiSchema,
+ schema: combatOperationService.schema,
+ },
+ agentOrangeExposure: {
+ path: 'military-service/agent-orange-exposure',
+ title: 'Agent Orange exposure',
+ depends: includeTeraInformation,
+ uiSchema: agentOrangeExposure.uiSchema,
+ schema: agentOrangeExposure.schema,
+ },
+ otherToxicExposure: {
+ path: 'military-service/other-toxic-exposure',
+ title: 'Other toxic exposures',
+ depends: includeTeraInformation,
+ uiSchema: otherToxicExposure.uiSchema,
+ schema: otherToxicExposure.schema,
+ },
+ otherToxicExposureDetails: {
+ path: 'military-service/other-toxins-or-hazards',
+ title: 'Other toxin or hazard exposure',
+ depends: includeOtherExposureDetails,
+ uiSchema: otherToxicExposureDetails.uiSchema,
+ schema: otherToxicExposureDetails.schema,
+ },
+ otherToxicExposureDates: {
+ path: 'military-service/other-toxic-exposure-dates',
+ title: 'Other toxic exposure dates',
+ depends: includeOtherExposureDates,
+ uiSchema: otherToxicExposureDates.uiSchema,
+ schema: otherToxicExposureDates.schema,
+ },
documentUpload: {
title: 'Upload your discharge papers',
path: 'military-service/documents',
- depends: formData =>
- !isShortFormEligible(formData) && !formData['view:isUserInMvi'],
+ depends: dischargePapersRequired,
editModeOnReviewPage: true,
uiSchema: documentUpload.uiSchema,
schema: documentUpload.schema,
@@ -281,7 +370,7 @@ const formConfig = {
FinancialOnboarding: {
path: 'household-information/financial-information-use',
title: 'Financial information use',
- depends: formData => !isShortFormEligible(formData),
+ depends: notShortFormEligible,
CustomPage: FinancialOnboarding,
CustomPageReview: null,
uiSchema: {},
@@ -290,16 +379,14 @@ const formConfig = {
FinancialDisclosure: {
path: 'household-information/share-financial-information',
title: 'Share financial information',
- depends: formData => !isShortFormEligible(formData),
+ depends: notShortFormEligible,
uiSchema: FinancialDisclosure.uiSchema,
schema: FinancialDisclosure.schema,
},
FinancialConfirmation: {
path: 'household-information/share-financial-information-confirm',
title: 'Share financial information confirmation',
- depends: formData =>
- !isShortFormEligible(formData) &&
- !formData.discloseFinancialInformation,
+ depends: showFinancialConfirmation,
CustomPage: FinancialConfirmation,
CustomPageReview: null,
uiSchema: {},
@@ -308,9 +395,7 @@ const formConfig = {
FinancialInformation: {
path: 'household-information/financial-information-needed',
title: 'Financial information needed',
- depends: formData =>
- !isShortFormEligible(formData) &&
- formData.discloseFinancialInformation,
+ depends: includeHouseholdInformation,
CustomPage: FinancialInformation,
CustomPageReview: null,
uiSchema: {},
@@ -320,7 +405,7 @@ const formConfig = {
path: 'household-information/marital-status',
title: 'Marital status',
initialData: {},
- depends: formData => !isShortFormEligible(formData),
+ depends: notShortFormEligible,
uiSchema: MaritalStatus.uiSchema,
schema: MaritalStatus.schema,
},
@@ -328,9 +413,7 @@ const formConfig = {
path: 'household-information/spouse-personal-information',
title: 'Spouse\u2019s personal information',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) &&
- includeSpousalInformation(formData),
+ depends: includeSpousalInformation,
uiSchema: SpouseBasicInformation.uiSchema,
schema: SpouseBasicInformation.schema,
},
@@ -338,19 +421,14 @@ const formConfig = {
path: 'household-information/spouse-additional-information',
title: 'Spouse\u2019s additional information',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) &&
- includeSpousalInformation(formData),
+ depends: includeSpousalInformation,
uiSchema: SpouseAdditionalInformation.uiSchema,
schema: SpouseAdditionalInformation.schema,
},
SpouseFinancialSupport: {
path: 'household-information/spouse-financial-support',
title: 'Spouse\u2019s financial support',
- depends: formData =>
- !isShortFormEligible(formData) &&
- includeSpousalInformation(formData) &&
- !formData.cohabitedLastYear,
+ depends: spouseDidNotCohabitateWithVeteran,
uiSchema: SpouseFinancialSupport.uiSchema,
schema: SpouseFinancialSupport.schema,
},
@@ -358,19 +436,14 @@ const formConfig = {
path: 'household-information/spouse-contact-information',
title: 'Spouse\u2019s address and phone number',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) &&
- includeSpousalInformation(formData) &&
- !formData.sameAddress,
+ depends: spouseAddressDoesNotMatchVeterans,
uiSchema: SpouseContactInformation.uiSchema,
schema: SpouseContactInformation.schema,
},
DependentSummary: {
path: DEPENDENT_PATHS.summary,
title: 'Dependents',
- depends: formData =>
- !isShortFormEligible(formData) &&
- formData.discloseFinancialInformation,
+ depends: includeHouseholdInformation,
CustomPage: DependentSummaryPage,
CustomPageReview: DependentsReviewPage,
uiSchema: DependentSummary.uiSchema,
@@ -379,10 +452,7 @@ const formConfig = {
DependentInformation: {
path: DEPENDENT_PATHS.info,
title: 'Dependent information',
- depends: formData =>
- !isShortFormEligible(formData) &&
- !formData['view:skipDependentInfo'] &&
- formData.discloseFinancialInformation,
+ depends: includeDependentInformation,
CustomPage: DependentInformationPage,
CustomPageReview: null,
uiSchema: {},
@@ -392,9 +462,7 @@ const formConfig = {
path: 'household-information/veteran-annual-income',
title: 'Your annual income',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) &&
- formData.discloseFinancialInformation,
+ depends: includeHouseholdInformation,
uiSchema: VeteranAnnualIncome.uiSchema,
schema: VeteranAnnualIncome.schema,
},
@@ -402,9 +470,7 @@ const formConfig = {
path: 'household-information/spouse-annual-income',
title: 'Spouse\u2019s annual income',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) &&
- includeSpousalInformation(formData),
+ depends: includeSpousalInformation,
uiSchema: SpouseAnnualIncome.uiSchema,
schema: SpouseAnnualIncome.schema,
},
@@ -412,9 +478,7 @@ const formConfig = {
path: 'household-information/deductible-expenses',
title: 'Deductible expenses',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) &&
- formData.discloseFinancialInformation,
+ depends: includeHouseholdInformation,
uiSchema: DeductibleExpenses.uiSchema,
schema: DeductibleExpenses.schema,
},
@@ -434,7 +498,7 @@ const formConfig = {
path: 'insurance-information/medicare',
title: 'Medicare coverage',
initialData: {},
- depends: formData => !isShortFormEligible(formData),
+ depends: notShortFormEligible,
uiSchema: medicare.uiSchema,
schema: medicare.schema,
},
@@ -442,8 +506,7 @@ const formConfig = {
path: 'insurance-information/medicare-part-a-effective-date',
title: 'Medicare Part A effective date',
initialData: {},
- depends: formData =>
- !isShortFormEligible(formData) && formData.isEnrolledMedicarePartA,
+ depends: collectMedicareInformation,
uiSchema: medicarePartAEffectiveDate.uiSchema,
schema: medicarePartAEffectiveDate.schema,
},
@@ -459,7 +522,7 @@ const formConfig = {
initialData: {
isEssentialAcaCoverage: false,
},
- depends: formData => !formData['view:isFacilitiesApiEnabled'],
+ depends: useJsonFacilityList,
uiSchema: vaFacilityJsonPage.uiSchema,
schema: vaFacilityJsonPage.schema,
},
@@ -469,7 +532,7 @@ const formConfig = {
initialData: {
isEssentialAcaCoverage: false,
},
- depends: formData => formData['view:isFacilitiesApiEnabled'],
+ depends: useLighthouseFacilityList,
uiSchema: vaFacilityApiPage.uiSchema,
schema: vaFacilityApiPage.schema,
},
diff --git a/src/applications/hca/containers/App.jsx b/src/applications/hca/containers/App.jsx
index fc4c1ead4832..4e23e3a0031f 100644
--- a/src/applications/hca/containers/App.jsx
+++ b/src/applications/hca/containers/App.jsx
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import RoutedSavableApp from '@department-of-veterans-affairs/platform-forms/RoutedSavableApp';
import { setData } from '@department-of-veterans-affairs/platform-forms-system/actions';
import { isLOA3, isLoggedIn, selectProfile } from 'platform/user/selectors';
+import { VA_FORM_IDS } from 'platform/forms/constants';
import recordEvent from 'platform/monitoring/record-event';
import { fetchTotalDisabilityRating } from '../utils/actions';
@@ -20,16 +21,22 @@ const App = props => {
isLoadingFeatureFlags,
isFacilitiesApiEnabled,
isSigiEnabled,
+ isTeraEnabled,
} = useSelector(selectFeatureToggles);
- const { dob: veteranDob, loading: isLoadingProfile } = useSelector(
- selectProfile,
- );
+ const {
+ savedForms,
+ dob: veteranDob,
+ loading: isLoadingProfile,
+ } = useSelector(selectProfile);
const { totalDisabilityRating } = useSelector(state => state.totalRating);
const { data: formData } = useSelector(state => state.form);
const loggedIn = useSelector(isLoggedIn);
const isLOA3User = useSelector(isLOA3);
const { veteranFullName } = formData;
const isAppLoading = isLoadingFeatureFlags || isLoadingProfile;
+ const hasSavedForm = savedForms.some(
+ o => o.form === VA_FORM_IDS.FORM_10_10EZ,
+ );
// Attempt to fetch disability rating for LOA3 users
useEffect(
@@ -61,16 +68,23 @@ const App = props => {
'view:totalDisabilityRating': parseInt(totalDisabilityRating, 10) || 0,
};
- if (loggedIn) {
+ if (hasSavedForm || typeof hasSavedForm === 'undefined') {
+ setFormData({
+ ...formData,
+ ...defaultViewFields,
+ });
+ } else if (loggedIn) {
setFormData({
...formData,
...defaultViewFields,
'view:userDob': parseVeteranDob(veteranDob),
+ 'view:isTeraEnabled': isTeraEnabled,
});
} else {
setFormData({
...formData,
...defaultViewFields,
+ 'view:isTeraEnabled': isTeraEnabled,
});
}
},
@@ -78,9 +92,11 @@ const App = props => {
// eslint-disable-next-line react-hooks/exhaustive-deps
[
loggedIn,
+ hasSavedForm,
veteranDob,
veteranFullName,
isSigiEnabled,
+ isTeraEnabled,
isFacilitiesApiEnabled,
totalDisabilityRating,
],
diff --git a/src/applications/hca/definitions/attachments.js b/src/applications/hca/definitions/attachments.js
new file mode 100644
index 000000000000..b91fba29d449
--- /dev/null
+++ b/src/applications/hca/definitions/attachments.js
@@ -0,0 +1,32 @@
+export const attachmentsSchema = {
+ type: 'array',
+ minItems: 1,
+ items: {
+ type: 'object',
+ required: ['attachmentId', 'name'],
+ properties: {
+ name: {
+ type: 'string',
+ },
+ size: {
+ type: 'integer',
+ },
+ confirmationCode: {
+ type: 'string',
+ },
+ attachmentId: {
+ type: 'string',
+ enum: ['1', '2', '3', '4', '5', '6', '7'],
+ enumNames: [
+ 'DD214',
+ 'DD215 (used to correct or make additions to the DD214)',
+ 'WD AGO 53-55 (report of separation used prior to 1950)',
+ 'Other discharge papers (like your DD256, DD257, or NGB22)',
+ 'Official documentation of a military award (like a Purple Heart, Medal of Honor, or Silver Star)',
+ 'Disability rating letter from the Veterans Benefit Administration (VBA)',
+ 'Other official military document',
+ ],
+ },
+ },
+ },
+};
diff --git a/src/applications/hca/tests/e2e/fixtures/data/data.unit.spec.js b/src/applications/hca/tests/e2e/fixtures/data/data.unit.spec.js
deleted file mode 100644
index 3b9b0f6b1665..000000000000
--- a/src/applications/hca/tests/e2e/fixtures/data/data.unit.spec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-import { expect } from 'chai';
-import { Validator } from 'jsonschema';
-
-import fullSchemaHca from 'vets-json-schema/dist/10-10EZ-schema.json';
-import { transform } from '../../../../utils/helpers';
-import formConfig from '../../../../config/form';
-
-describe('hca data tests', () => {
- const v = new Validator();
- const files = fs.readdirSync(__dirname);
- files.filter(file => file.endsWith('json')).forEach(file => {
- it.skip(`should validate ${file}`, () => {
- const contents = JSON.parse(
- fs.readFileSync(path.join(__dirname, file), 'utf8'),
- );
- const submitData = JSON.parse(transform(formConfig, contents)).form;
- const data = JSON.parse(submitData);
- const result = v.validate(data, fullSchemaHca);
- if (!result.valid) {
- console.log(result.errors); // eslint-disable-line no-console
- }
- expect(typeof data.dependents).not.to.equal('undefined');
- expect(result.valid).to.be.true;
- });
- });
-});
diff --git a/src/applications/hca/tests/e2e/fixtures/data/foreign-address-test.json b/src/applications/hca/tests/e2e/fixtures/data/foreign-address-test.json
index 0d6fcf14b64c..ff15634e33ad 100644
--- a/src/applications/hca/tests/e2e/fixtures/data/foreign-address-test.json
+++ b/src/applications/hca/tests/e2e/fixtures/data/foreign-address-test.json
@@ -15,6 +15,7 @@
"lastEntryDate": "2006-01-01",
"lastDischargeDate": "2007-01-04",
"dischargeType": "honorable",
+ "hasTeraResponse": false,
"veteranAddress": {
"street": "123 elm st",
"city": "Northampton",
@@ -34,7 +35,9 @@
},
"gender": "F",
"maritalStatus": "Never Married",
- "view:demographicCategories": {},
+ "view:demographicCategories": {
+ "isSpanishHispanicLatino": false
+ },
"veteranDateOfBirth": "1990-01-01",
"veteranSocialSecurityNumber": "234243444",
"view:placeOfBirth": {},
@@ -43,7 +46,6 @@
"last": "Doe"
},
"privacyAgreementAccepted": true,
- "isSpanishHispanicLatino": false,
"spouseFullName": {}
}
}
diff --git a/src/applications/hca/tests/e2e/fixtures/data/maximal-test.json b/src/applications/hca/tests/e2e/fixtures/data/maximal-test.json
index 115f3a85877f..c1c626c737a7 100644
--- a/src/applications/hca/tests/e2e/fixtures/data/maximal-test.json
+++ b/src/applications/hca/tests/e2e/fixtures/data/maximal-test.json
@@ -80,19 +80,47 @@
},
"discloseFinancialInformation": true,
"vaCompensationType": "lowDisability",
- "purpleHeartRecipient": true,
- "isFormerPow": true,
- "postNov111998Combat": true,
- "disabledInLineOfDuty": true,
- "swAsiaCombat": true,
- "vietnamService": true,
- "exposedToRadiation": true,
- "radiumTreatments": true,
- "campLejeune": true,
+ "view:serviceHistory": {
+ "purpleHeartRecipient": true,
+ "isFormerPow": true,
+ "postNov111998Combat": true,
+ "disabledInLineOfDuty": true,
+ "swAsiaCombat": true,
+ "vietnamService": true,
+ "exposedToRadiation": true,
+ "radiumTreatments": true,
+ "campLejeune": true
+ },
"lastServiceBranch": "air force",
"lastEntryDate": "2000-01-02",
"lastDischargeDate": "2005-02-01",
"dischargeType": "general",
+ "hasTeraResponse": true,
+ "radiationCleanupEfforts": true,
+ "gulfWarService": true,
+ "view:gulfWarServiceDates": {
+ "gulfWarStartDate": "1990-09-XX",
+ "gulfWarEndDate": "1991-01-XX"
+ },
+ "combatOperationService": true,
+ "exposedToAgentOrange": true,
+ "view:otherToxicExposures": {
+ "exposureToAirPollutants": true,
+ "exposureToAsbestos": true,
+ "exposureToChemicals": true,
+ "exposureToContaminatedWater": true,
+ "exposureToMustardGas": true,
+ "exposureToOccupationalHazards": true,
+ "exposureToRadiation": true,
+ "exposureToShad": true,
+ "exposureToWarfareAgents": true,
+ "exposureToOther": true
+ },
+ "otherToxicExposure": "sometoxinname",
+ "view:toxicExposureDates": {
+ "toxicExposureStartDate": "1990-09-XX",
+ "toxicExposureEndDate": "1991-01-XX"
+ },
"email": "test@test.com",
"homePhone": "5555555555",
"mobilePhone": "4444444444",
@@ -126,7 +154,7 @@
"isAsian": true,
"isWhite": true
},
- "veteranDateOfBirth": "1980-03-02",
+ "veteranDateOfBirth": "1970-03-02",
"veteranSocialSecurityNumber": "324234444",
"view:placeOfBirth": {
"cityOfBirth": "Boston",
diff --git a/src/applications/hca/tests/e2e/fixtures/data/minimal-test.json b/src/applications/hca/tests/e2e/fixtures/data/minimal-test.json
index 682379048782..556eab29e920 100644
--- a/src/applications/hca/tests/e2e/fixtures/data/minimal-test.json
+++ b/src/applications/hca/tests/e2e/fixtures/data/minimal-test.json
@@ -15,6 +15,7 @@
"lastEntryDate": "2006-01-01",
"lastDischargeDate": "2007-01-04",
"dischargeType": "honorable",
+ "hasTeraResponse": false,
"veteranAddress": {
"street": "123 elm st",
"city": "Northampton",
diff --git a/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles-with-tera.json b/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles-with-tera.json
new file mode 100644
index 000000000000..b9ba042e5f52
--- /dev/null
+++ b/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles-with-tera.json
@@ -0,0 +1,23 @@
+{
+ "data": {
+ "type": "feature_toggles",
+ "features": [
+ {
+ "name": "hca_sigi_enabled",
+ "value": false
+ },
+ {
+ "name": "hca_tera_enabled",
+ "value": true
+ },
+ {
+ "name": "hca_browser_monitoring_enabled",
+ "value": false
+ },
+ {
+ "name": "hca_use_facilities_api",
+ "value": false
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles.json b/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles.json
index d17f06667a32..0452da2267aa 100644
--- a/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles.json
+++ b/src/applications/hca/tests/e2e/fixtures/mocks/feature-toggles.json
@@ -3,15 +3,19 @@
"type": "feature_toggles",
"features": [
{
- "name": "hcaSigiEnabled",
+ "name": "hca_sigi_enabled",
"value": false
},
{
- "name": "hcaBrowserMonitoringEnabled",
+ "name": "hca_tera_enabled",
"value": false
},
{
- "name": "hcaUseFacilitiesApi",
+ "name": "hca_browser_monitoring_enabled",
+ "value": false
+ },
+ {
+ "name": "hca_use_facilities_api",
"value": false
}
]
diff --git a/src/applications/hca/tests/e2e/hca-household.cypress.spec.js b/src/applications/hca/tests/e2e/hca-household.cypress.spec.js
index e1804c466330..0656be3eeed7 100644
--- a/src/applications/hca/tests/e2e/hca-household.cypress.spec.js
+++ b/src/applications/hca/tests/e2e/hca-household.cypress.spec.js
@@ -6,6 +6,7 @@ import mockEnrollmentStatus from './fixtures/mocks/mockEnrollmentStatus.json';
import mockPrefill from './fixtures/mocks/mockPrefill.json';
import maxTestData from './fixtures/data/maximal-test.json';
import {
+ acceptPrivacyAgreement,
advanceToHousehold,
advanceFromHouseholdToReview,
goToNextPage,
@@ -78,11 +79,7 @@ describe('HCA-Household-Non-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -146,11 +143,7 @@ describe('HCA-Household-Non-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -266,11 +259,7 @@ describe('HCA-Household-Spousal-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -372,11 +361,7 @@ describe('HCA-Household-Spousal-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -489,11 +474,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -577,11 +558,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -663,11 +640,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -754,11 +727,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -834,11 +803,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -919,11 +884,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -1002,11 +963,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -1090,11 +1047,7 @@ describe('HCA-Household-Dependent-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
@@ -1233,11 +1186,7 @@ describe('HCA-Household-Full-Disclosure', () => {
advanceFromHouseholdToReview();
// accept the privacy agreement
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
// submit form
cy.findByText(/submit/i, { selector: 'button' }).click();
diff --git a/src/applications/hca/tests/e2e/hca-shortform.cypress.spec.js b/src/applications/hca/tests/e2e/hca-shortform.cypress.spec.js
index 336ccb0f1a10..1d8f52673981 100644
--- a/src/applications/hca/tests/e2e/hca-shortform.cypress.spec.js
+++ b/src/applications/hca/tests/e2e/hca-shortform.cypress.spec.js
@@ -6,6 +6,7 @@ import mockEnrollmentStatus from './fixtures/mocks/mockEnrollmentStatus.json';
import mockPrefill from './fixtures/mocks/mockPrefill.json';
import minTestData from './fixtures/data/minimal-test.json';
import {
+ acceptPrivacyAgreement,
goToNextPage,
shortFormAdditionalHelpAssertion,
shortFormSelfDisclosureToSubmit,
@@ -146,12 +147,8 @@ describe('HCA-Shortform-Authenticated-High-Disability', () => {
);
goToNextPage('review-and-submit');
+ acceptPrivacyAgreement();
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
cy.findByText(/submit/i, { selector: 'button' }).click();
cy.wait('@mockSubmit');
cy.location('pathname').should('include', '/confirmation');
diff --git a/src/applications/hca/tests/e2e/hca-toxic-exposure.cypress.spec.js b/src/applications/hca/tests/e2e/hca-toxic-exposure.cypress.spec.js
new file mode 100644
index 000000000000..e8ab565fa29b
--- /dev/null
+++ b/src/applications/hca/tests/e2e/hca-toxic-exposure.cypress.spec.js
@@ -0,0 +1,290 @@
+import moment from 'moment';
+import manifest from '../../manifest.json';
+import featureToggles from './fixtures/mocks/feature-toggles-with-tera.json';
+import mockUser from './fixtures/mocks/mockUser';
+import mockEnrollmentStatus from './fixtures/mocks/mockEnrollmentStatus.json';
+import mockPrefill from './fixtures/mocks/mockPrefill.json';
+import {
+ advanceToToxicExposure,
+ advanceFromToxicExposureToReview,
+ goToNextPage,
+ fillGulfWarDateRange,
+ fillToxicExposureDateRange,
+} from './utils';
+
+describe('HCA-Toxic-Exposure-Non-Disclosure', () => {
+ beforeEach(() => {
+ cy.login(mockUser);
+ cy.intercept('GET', '/v0/feature_toggles*', featureToggles).as(
+ 'mockFeatures',
+ );
+ cy.intercept('GET', '/v0/health_care_applications/enrollment_status*', {
+ statusCode: 404,
+ body: mockEnrollmentStatus,
+ }).as('mockEnrollmentStatus');
+ cy.intercept('/v0/in_progress_forms/1010ez', {
+ statusCode: 200,
+ body: mockPrefill,
+ }).as('mockSip');
+ cy.intercept('/v0/health_care_applications/rating_info', {
+ statusCode: 200,
+ body: {
+ data: {
+ id: '',
+ type: 'hash',
+ attributes: { userPercentOfDisability: 0 },
+ },
+ },
+ }).as('mockDisabilityRating');
+ cy.intercept('POST', '/v0/health_care_applications', {
+ statusCode: 200,
+ body: {
+ formSubmissionId: '123fake-submission-id-567',
+ timestamp: moment().format('YYYY-MM-DD'),
+ },
+ }).as('mockSubmit');
+ });
+
+ it('works without sharing toxic exposure service history', () => {
+ cy.visit(manifest.rootUrl);
+ cy.wait(['@mockUser', '@mockFeatures', '@mockEnrollmentStatus']);
+
+ cy.findAllByText(/apply.+health care/i, { selector: 'h1' })
+ .first()
+ .should('exist');
+
+ advanceToToxicExposure();
+
+ goToNextPage('/military-service/toxic-exposure');
+ cy.get('[name="root_hasTeraResponse"]').check('N');
+
+ advanceFromToxicExposureToReview();
+
+ // accept the privacy agreement
+ cy.get('va-checkbox[name="privacyAgreementAccepted"]')
+ .scrollIntoView()
+ .shadow()
+ .find('label')
+ .click();
+
+ // submit form
+ cy.findByText(/submit/i, { selector: 'button' }).click();
+
+ // check for correct disclosure value
+ cy.wait('@mockSubmit').then(interception => {
+ cy.wrap(JSON.parse(interception.request.body.form))
+ .its('hasTeraResponse')
+ .should('be.false');
+ });
+ cy.location('pathname').should('include', '/confirmation');
+
+ cy.injectAxe();
+ cy.axeCheck();
+ });
+});
+
+describe('HCA-Toxic-Exposure-Disclosure', () => {
+ beforeEach(() => {
+ cy.login(mockUser);
+ cy.intercept('GET', '/v0/feature_toggles*', featureToggles).as(
+ 'mockFeatures',
+ );
+ cy.intercept('GET', '/v0/health_care_applications/enrollment_status*', {
+ statusCode: 404,
+ body: mockEnrollmentStatus,
+ }).as('mockEnrollmentStatus');
+ cy.intercept('/v0/in_progress_forms/1010ez', {
+ statusCode: 200,
+ body: mockPrefill,
+ }).as('mockSip');
+ cy.intercept('/v0/health_care_applications/rating_info', {
+ statusCode: 200,
+ body: {
+ data: {
+ id: '',
+ type: 'hash',
+ attributes: { userPercentOfDisability: 0 },
+ },
+ },
+ }).as('mockDisabilityRating');
+ cy.intercept('POST', '/v0/health_care_applications', {
+ statusCode: 200,
+ body: {
+ formSubmissionId: '123fake-submission-id-567',
+ timestamp: moment().format('YYYY-MM-DD'),
+ },
+ }).as('mockSubmit');
+ });
+
+ it('works when sharing minimum toxic exposure service history', () => {
+ cy.visit(manifest.rootUrl);
+ cy.wait(['@mockUser', '@mockFeatures', '@mockEnrollmentStatus']);
+
+ cy.findAllByText(/apply.+health care/i, { selector: 'h1' })
+ .first()
+ .should('exist');
+
+ advanceToToxicExposure();
+
+ goToNextPage('/military-service/toxic-exposure');
+ cy.get('[name="root_hasTeraResponse"]').check('Y');
+
+ goToNextPage('/military-service/radiation-cleanup-efforts');
+ cy.get('[name="root_radiationCleanupEfforts"]').check('N');
+
+ goToNextPage('/military-service/gulf-war-service');
+ cy.get('[name="root_gulfWarService"]').check('N');
+
+ goToNextPage('/military-service/operation-support');
+ cy.get('[name="root_combatOperationService"]').check('N');
+
+ goToNextPage('/military-service/agent-orange-exposure');
+ cy.get('[name="root_exposedToAgentOrange"]').check('N');
+
+ goToNextPage('/military-service/other-toxic-exposure');
+
+ advanceFromToxicExposureToReview();
+
+ // accept the privacy agreement
+ cy.get('va-checkbox[name="privacyAgreementAccepted"]')
+ .scrollIntoView()
+ .shadow()
+ .find('label')
+ .click();
+
+ // submit form
+ cy.findByText(/submit/i, { selector: 'button' }).click();
+
+ // check for correct disclosure value
+ cy.wait('@mockSubmit').then(interception => {
+ cy.wrap(JSON.parse(interception.request.body.form))
+ .its('hasTeraResponse')
+ .should('be.true');
+ });
+ cy.location('pathname').should('include', '/confirmation');
+
+ cy.injectAxe();
+ cy.axeCheck();
+ });
+
+ it('works when sharing maximum toxic exposure service history', () => {
+ cy.visit(manifest.rootUrl);
+ cy.wait(['@mockUser', '@mockFeatures', '@mockEnrollmentStatus']);
+
+ cy.findAllByText(/apply.+health care/i, { selector: 'h1' })
+ .first()
+ .should('exist');
+
+ advanceToToxicExposure();
+
+ goToNextPage('/military-service/toxic-exposure');
+ cy.get('[name="root_hasTeraResponse"]').check('Y');
+
+ goToNextPage('/military-service/radiation-cleanup-efforts');
+ cy.get('[name="root_radiationCleanupEfforts"]').check('Y');
+
+ goToNextPage('/military-service/gulf-war-service');
+ cy.get('[name="root_gulfWarService"]').check('Y');
+
+ goToNextPage('/military-service/gulf-war-service-dates');
+ fillGulfWarDateRange();
+
+ goToNextPage('/military-service/operation-support');
+ cy.get('[name="root_combatOperationService"]').check('Y');
+
+ goToNextPage('/military-service/agent-orange-exposure');
+ cy.get('[name="root_exposedToAgentOrange"]').check('Y');
+
+ goToNextPage('/military-service/other-toxic-exposure');
+ cy.get(
+ '[name="root_view:otherToxicExposures_exposureToAirPollutants"]',
+ ).check();
+
+ goToNextPage('/military-service/other-toxic-exposure-dates');
+ fillToxicExposureDateRange();
+
+ advanceFromToxicExposureToReview();
+
+ // accept the privacy agreement
+ cy.get('va-checkbox[name="privacyAgreementAccepted"]')
+ .scrollIntoView()
+ .shadow()
+ .find('label')
+ .click();
+
+ // submit form
+ cy.findByText(/submit/i, { selector: 'button' }).click();
+
+ // check for correct disclosure value
+ cy.wait('@mockSubmit').then(interception => {
+ cy.wrap(JSON.parse(interception.request.body.form))
+ .its('hasTeraResponse')
+ .should('be.true');
+ });
+ cy.location('pathname').should('include', '/confirmation');
+
+ cy.injectAxe();
+ cy.axeCheck();
+ });
+
+ it('works when `not listed here` has been selected for other toxic exposures', () => {
+ cy.visit(manifest.rootUrl);
+ cy.wait(['@mockUser', '@mockFeatures', '@mockEnrollmentStatus']);
+
+ cy.findAllByText(/apply.+health care/i, { selector: 'h1' })
+ .first()
+ .should('exist');
+
+ advanceToToxicExposure();
+
+ goToNextPage('/military-service/toxic-exposure');
+ cy.get('[name="root_hasTeraResponse"]').check('Y');
+
+ goToNextPage('/military-service/radiation-cleanup-efforts');
+ cy.get('[name="root_radiationCleanupEfforts"]').check('Y');
+
+ goToNextPage('/military-service/gulf-war-service');
+ cy.get('[name="root_gulfWarService"]').check('Y');
+
+ goToNextPage('/military-service/gulf-war-service-dates');
+ fillGulfWarDateRange();
+
+ goToNextPage('/military-service/operation-support');
+ cy.get('[name="root_combatOperationService"]').check('Y');
+
+ goToNextPage('/military-service/agent-orange-exposure');
+ cy.get('[name="root_exposedToAgentOrange"]').check('Y');
+
+ goToNextPage('/military-service/other-toxic-exposure');
+ cy.get('[name="root_view:otherToxicExposures_exposureToOther"]').check();
+
+ goToNextPage('/military-service/other-toxins-or-hazards');
+ cy.get('[name="root_otherToxicExposure"]').type('sometoxinname');
+
+ goToNextPage('/military-service/other-toxic-exposure-dates');
+ fillToxicExposureDateRange();
+
+ advanceFromToxicExposureToReview();
+
+ // accept the privacy agreement
+ cy.get('va-checkbox[name="privacyAgreementAccepted"]')
+ .scrollIntoView()
+ .shadow()
+ .find('label')
+ .click();
+
+ // submit form
+ cy.findByText(/submit/i, { selector: 'button' }).click();
+
+ // check for correct disclosure value
+ cy.wait('@mockSubmit').then(interception => {
+ cy.wrap(JSON.parse(interception.request.body.form))
+ .its('hasTeraResponse')
+ .should('be.true');
+ });
+ cy.location('pathname').should('include', '/confirmation');
+
+ cy.injectAxe();
+ cy.axeCheck();
+ });
+});
diff --git a/src/applications/hca/tests/e2e/hca.cypress.spec.js b/src/applications/hca/tests/e2e/hca.cypress.spec.js
index 387cc1b42205..6bf503022dd1 100644
--- a/src/applications/hca/tests/e2e/hca.cypress.spec.js
+++ b/src/applications/hca/tests/e2e/hca.cypress.spec.js
@@ -7,7 +7,7 @@ import manifest from '../../manifest.json';
import featureToggles from './fixtures/mocks/feature-toggles.json';
import mockFacilities from './fixtures/mocks/mockFacilities.json';
import mockEnrollmentStatus from './fixtures/mocks/mockEnrollmentStatus.json';
-import { goToNextPage } from './utils';
+import { acceptPrivacyAgreement, goToNextPage } from './utils';
const testConfig = createTestConfig(
{
@@ -120,11 +120,7 @@ const testConfig = createTestConfig(
},
'review-and-submit': ({ afterHook }) => {
afterHook(() => {
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
cy.findByText(/submit/i, { selector: 'button' }).click();
});
},
diff --git a/src/applications/hca/tests/e2e/utils/index.js b/src/applications/hca/tests/e2e/utils/index.js
index 200deb217e22..cc8bdadcf2a3 100644
--- a/src/applications/hca/tests/e2e/utils/index.js
+++ b/src/applications/hca/tests/e2e/utils/index.js
@@ -2,6 +2,14 @@ import maxTestData from '../fixtures/data/maximal-test.json';
const { data: testData } = maxTestData;
+export const acceptPrivacyAgreement = () => {
+ cy.get('va-checkbox[name="privacyAgreementAccepted"]')
+ .scrollIntoView()
+ .shadow()
+ .find('label')
+ .click();
+};
+
export const goToNextPage = pagePath => {
// Clicks Continue button, and optionally checks destination path.
cy.findAllByText(/continue|confirm/i, { selector: 'button' })
@@ -13,6 +21,114 @@ export const goToNextPage = pagePath => {
}
};
+export const advanceToToxicExposure = () => {
+ cy.get('[href="#start"]')
+ .first()
+ .click();
+ cy.wait('@mockSip');
+ cy.location('pathname').should(
+ 'include',
+ '/veteran-information/personal-information',
+ );
+ goToNextPage('/veteran-information/birth-information');
+ goToNextPage('/veteran-information/maiden-name-information');
+ goToNextPage('/veteran-information/birth-sex');
+ goToNextPage('/veteran-information/demographic-information');
+ goToNextPage('/veteran-information/veteran-address');
+ cy.get('[name="root_view:doesMailingMatchHomeAddress"]').check('Y');
+
+ goToNextPage('/veteran-information/contact-information');
+ cy.wait('@mockSip');
+ goToNextPage('/va-benefits/basic-information');
+ cy.get('[name="root_vaCompensationType"]').check('none');
+ goToNextPage('/va-benefits/pension-information');
+ cy.get('[name="root_vaPensionType"]').check('No');
+ goToNextPage('/military-service/service-information');
+ goToNextPage('/military-service/additional-information');
+};
+
+export const advanceFromToxicExposureToReview = () => {
+ goToNextPage('/household-information/financial-information-use');
+
+ goToNextPage('/household-information/share-financial-information');
+ cy.get('[name="root_discloseFinancialInformation"]').check('N');
+
+ goToNextPage('/household-information/share-financial-information-confirm');
+ cy.findAllByText(/confirm/i, { selector: 'button' })
+ .first()
+ .click();
+
+ goToNextPage('/household-information/marital-status');
+ cy.get('#root_maritalStatus').select(testData.maritalStatus);
+
+ goToNextPage('/insurance-information/medicaid');
+ cy.get('[name="root_isMedicaidEligible"]').check('N');
+
+ goToNextPage('/insurance-information/medicare');
+ cy.get('[name="root_isEnrolledMedicarePartA"]').check('N');
+
+ goToNextPage('/insurance-information/general');
+ cy.get('[name="root_isCoveredByHealthInsurance"]').check('N');
+
+ goToNextPage('/insurance-information/va-facility');
+ cy.get('[name="root_view:preferredFacility_view:facilityState"]').select(
+ testData['view:preferredFacility']['view:facilityState'],
+ );
+ cy.get('[name="root_view:preferredFacility_vaMedicalFacility"]').select(
+ testData['view:preferredFacility'].vaMedicalFacility,
+ );
+
+ goToNextPage('review-and-submit');
+};
+
+export const fillGulfWarDateRange = () => {
+ const { gulfWarStartDate, gulfWarEndDate } = testData[
+ 'view:gulfWarServiceDates'
+ ];
+ const [startYear, startMonth] = gulfWarStartDate
+ .split('-')
+ .map(dateComponent => parseInt(dateComponent, 10).toString());
+ const [endYear, endMonth] = gulfWarEndDate
+ .split('-')
+ .map(dateComponent => parseInt(dateComponent, 10).toString());
+ cy.get('[name="root_view:gulfWarServiceDates_gulfWarStartDateMonth"]').select(
+ startMonth,
+ );
+ cy.get('[name="root_view:gulfWarServiceDates_gulfWarStartDateYear"]').type(
+ startYear,
+ );
+ cy.get('[name="root_view:gulfWarServiceDates_gulfWarEndDateMonth"]').select(
+ endMonth,
+ );
+ cy.get('[name="root_view:gulfWarServiceDates_gulfWarEndDateYear"]').type(
+ endYear,
+ );
+};
+
+export const fillToxicExposureDateRange = () => {
+ const { toxicExposureStartDate, toxicExposureEndDate } = testData[
+ 'view:toxicExposureDates'
+ ];
+ const [startYear, startMonth] = toxicExposureStartDate
+ .split('-')
+ .map(dateComponent => parseInt(dateComponent, 10).toString());
+ const [endYear, endMonth] = toxicExposureEndDate
+ .split('-')
+ .map(dateComponent => parseInt(dateComponent, 10).toString());
+ cy.get(
+ '[name="root_view:toxicExposureDates_toxicExposureStartDateMonth"]',
+ ).select(startMonth);
+ cy.get(
+ '[name="root_view:toxicExposureDates_toxicExposureStartDateYear"]',
+ ).type(startYear);
+ cy.get(
+ '[name="root_view:toxicExposureDates_toxicExposureEndDateMonth"]',
+ ).select(endMonth);
+ cy.get('[name="root_view:toxicExposureDates_toxicExposureEndDateYear"]').type(
+ endYear,
+ );
+};
+
export const advanceToHousehold = () => {
cy.get('[href="#start"]')
.first()
@@ -179,11 +295,8 @@ export const shortFormSelfDisclosureToSubmit = () => {
.next('dd')
.should('have.text', 'Yes (50% or higher rating)');
- cy.get('[name="privacyAgreementAccepted"]')
- .scrollIntoView()
- .shadow()
- .find('[type="checkbox"]')
- .check();
+ acceptPrivacyAgreement();
+
cy.findByText(/submit/i, { selector: 'button' }).click();
cy.wait('@mockSubmit').then(interception => {
// check submitted vaCompensationType value.
diff --git a/src/applications/hca/tests/unit/components/ConfirmationPage/ConfirmationScreenView.unit.spec.js b/src/applications/hca/tests/unit/components/ConfirmationPage/ConfirmationScreenView.unit.spec.js
index 40b07ff62ba0..96e168681b15 100644
--- a/src/applications/hca/tests/unit/components/ConfirmationPage/ConfirmationScreenView.unit.spec.js
+++ b/src/applications/hca/tests/unit/components/ConfirmationPage/ConfirmationScreenView.unit.spec.js
@@ -30,7 +30,7 @@ describe('hca ', () => {
it('should render subtitles and applicant name', () => {
const { container } = render();
const selectors = {
- subtitles: container.querySelectorAll('h2'),
+ subtitles: container.querySelectorAll('h2, h3'),
veteranName: container.querySelector('.hca-veteran-fullname'),
};
expect(selectors.subtitles).to.have.lengthOf(2);
diff --git a/src/applications/hca/tests/unit/components/FormFields/VaMedicalCenter.unit.spec.js b/src/applications/hca/tests/unit/components/FormFields/VaMedicalCenter.unit.spec.js
index abe829b37284..76d8370e7f34 100644
--- a/src/applications/hca/tests/unit/components/FormFields/VaMedicalCenter.unit.spec.js
+++ b/src/applications/hca/tests/unit/components/FormFields/VaMedicalCenter.unit.spec.js
@@ -52,19 +52,14 @@ describe('hca ', () => {
context('when the component renders on form page', () => {
const { mockStore, props } = getData({});
- it('should render `va-select` with empty option', () => {
+ it('should render `va-select`', () => {
const { container } = render(
,
);
- const selectors = {
- input: container.querySelector('#preferredFacility_vaMedicalFacility'),
- options: container.querySelectorAll('option'),
- };
- expect(selectors.input).to.exist;
- expect(selectors.options).to.have.lengthOf(1);
- expect(selectors.options[0]).to.have.attr('value', '');
+ const selector = container.querySelector(`#${props.id}`);
+ expect(selector).to.exist;
});
it('should not render the facility name container', () => {
diff --git a/src/applications/hca/tests/unit/components/FormPages/DisabilityConfirmation.unit.spec.js b/src/applications/hca/tests/unit/components/FormPages/DisabilityConfirmation.unit.spec.js
index 58c78cf4f731..bda6f44ec93b 100644
--- a/src/applications/hca/tests/unit/components/FormPages/DisabilityConfirmation.unit.spec.js
+++ b/src/applications/hca/tests/unit/components/FormPages/DisabilityConfirmation.unit.spec.js
@@ -13,11 +13,10 @@ describe('hca Disability Confirmation page', () => {
context('when the component renders', () => {
const { props } = getData();
- it('should render `va-alert` with correct status', () => {
+ it('should render `va-summary-box`', () => {
const { container } = render();
- const selector = container.querySelector('va-alert');
+ const selector = container.querySelector('va-summary-box');
expect(selector).to.exist;
- expect(selector).to.have.attr('status', 'info');
});
it('should render navigation buttons', () => {
diff --git a/src/applications/hca/tests/unit/components/FormPages/FinancialConfirmation.unit.spec.js b/src/applications/hca/tests/unit/components/FormPages/FinancialConfirmation.unit.spec.js
index 9c26f30ba184..59c71e13c610 100644
--- a/src/applications/hca/tests/unit/components/FormPages/FinancialConfirmation.unit.spec.js
+++ b/src/applications/hca/tests/unit/components/FormPages/FinancialConfirmation.unit.spec.js
@@ -12,9 +12,9 @@ describe('hca Financial Confirmation page', () => {
context('when the component renders', () => {
const { props } = getData();
- it('should render `va-alert` with correct title', () => {
+ it('should render `va-summary-box` with correct title', () => {
const { container } = render();
- const selector = container.querySelector('va-alert');
+ const selector = container.querySelector('va-summary-box');
expect(selector).to.exist;
expect(selector).to.contain.text(
'Confirm that you don\u2019t want to provide your household financial information',
diff --git a/src/applications/hca/tests/unit/components/FormReview/DependentsReviewPage.unit.spec.js b/src/applications/hca/tests/unit/components/FormReview/DependentsReviewPage.unit.spec.js
index 72af947ede15..67839f3751e1 100644
--- a/src/applications/hca/tests/unit/components/FormReview/DependentsReviewPage.unit.spec.js
+++ b/src/applications/hca/tests/unit/components/FormReview/DependentsReviewPage.unit.spec.js
@@ -40,7 +40,7 @@ describe('hca DependentsReviewPage', () => {
it('should not render edit button', () => {
const { container } = render();
- const selector = container.querySelector('.edit-btn');
+ const selector = container.querySelector('va-button[text="Edit"]');
expect(selector).to.not.exist;
});
@@ -59,7 +59,7 @@ describe('hca DependentsReviewPage', () => {
it('should render `Edit` button', () => {
const { container } = render();
- const selector = container.querySelector('.edit-btn');
+ const selector = container.querySelector('va-button[text="Edit"]');
expect(selector).to.exist;
});
@@ -75,7 +75,7 @@ describe('hca DependentsReviewPage', () => {
it('should fire event to trigger the edit flow', () => {
const { container } = render();
- const selector = container.querySelector('.edit-btn');
+ const selector = container.querySelector('va-button[text="Edit"]');
fireEvent.click(selector);
expect(props.editPage.called).to.be.true;
});
diff --git a/src/applications/hca/tests/unit/components/IntroductionPage/GetStarted/GetStarted.unit.spec.js b/src/applications/hca/tests/unit/components/IntroductionPage/GetStarted/GetStarted.unit.spec.js
index 34cfc67e1993..d44cca475fb7 100644
--- a/src/applications/hca/tests/unit/components/IntroductionPage/GetStarted/GetStarted.unit.spec.js
+++ b/src/applications/hca/tests/unit/components/IntroductionPage/GetStarted/GetStarted.unit.spec.js
@@ -81,13 +81,13 @@ describe('hca ', () => {
context('when the user is logged out', () => {
const { mockStore, props } = getData({});
- it('should render the correct number of login alerts', () => {
+ it('should render the correct number of login boxes', () => {
const { container } = render(
,
);
- const selector = container.querySelectorAll('va-alert');
+ const selector = container.querySelectorAll('va-alert, va-summary-box');
expect(selector).to.have.lengthOf(2);
});
diff --git a/src/applications/hca/tests/config/householdInformation/deductibleExpenses.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/deductibleExpenses.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/householdInformation/deductibleExpenses.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/deductibleExpenses.unit.spec.js
index fc6f6b90d82d..9a313407768a 100644
--- a/src/applications/hca/tests/config/householdInformation/deductibleExpenses.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/deductibleExpenses.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca DeductibleExpenses config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/financialDisclosure.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/financialDisclosure.unit.spec.js
similarity index 94%
rename from src/applications/hca/tests/config/householdInformation/financialDisclosure.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/financialDisclosure.unit.spec.js
index 065e66527460..420a1cd41568 100644
--- a/src/applications/hca/tests/config/householdInformation/financialDisclosure.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/financialDisclosure.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca FinancialDisclosure config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/maritalStatus.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/maritalStatus.unit.spec.js
similarity index 94%
rename from src/applications/hca/tests/config/householdInformation/maritalStatus.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/maritalStatus.unit.spec.js
index 7f56a9651f81..18224b380e4d 100644
--- a/src/applications/hca/tests/config/householdInformation/maritalStatus.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/maritalStatus.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca MaritalStatus config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/spouseAdditionalInformation.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/spouseAdditionalInformation.unit.spec.js
similarity index 94%
rename from src/applications/hca/tests/config/householdInformation/spouseAdditionalInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/spouseAdditionalInformation.unit.spec.js
index 772b0b33ee87..d7f7bad4ec85 100644
--- a/src/applications/hca/tests/config/householdInformation/spouseAdditionalInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/spouseAdditionalInformation.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca SpouseAdditionalInformation config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/spouseAnnualIncome.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/spouseAnnualIncome.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/householdInformation/spouseAnnualIncome.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/spouseAnnualIncome.unit.spec.js
index 41959f61eb32..c49ade98eace 100644
--- a/src/applications/hca/tests/config/householdInformation/spouseAnnualIncome.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/spouseAnnualIncome.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca SpouseAnnualIncome config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/spouseBasicInformation.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/spouseBasicInformation.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/householdInformation/spouseBasicInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/spouseBasicInformation.unit.spec.js
index 81ab53d51559..a163c7b7df69 100644
--- a/src/applications/hca/tests/config/householdInformation/spouseBasicInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/spouseBasicInformation.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca SpouseBasicInformation config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/spouseContactInformation.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/spouseContactInformation.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/householdInformation/spouseContactInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/spouseContactInformation.unit.spec.js
index 01e9bcd8819c..774214d9e3b8 100644
--- a/src/applications/hca/tests/config/householdInformation/spouseContactInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/spouseContactInformation.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca SpouseContactInformation config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/spouseFinancialSupport.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/spouseFinancialSupport.unit.spec.js
similarity index 96%
rename from src/applications/hca/tests/config/householdInformation/spouseFinancialSupport.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/spouseFinancialSupport.unit.spec.js
index 08fd6837c192..210a45272f52 100644
--- a/src/applications/hca/tests/config/householdInformation/spouseFinancialSupport.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/spouseFinancialSupport.unit.spec.js
@@ -8,7 +8,7 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
describe('hca SpouseFinancialSupport config', () => {
const {
diff --git a/src/applications/hca/tests/config/householdInformation/veteranAnnualIncome.unit.spec.js b/src/applications/hca/tests/unit/config/householdInformation/veteranAnnualIncome.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/householdInformation/veteranAnnualIncome.unit.spec.js
rename to src/applications/hca/tests/unit/config/householdInformation/veteranAnnualIncome.unit.spec.js
index 5c390ce382e6..8e94398139c7 100644
--- a/src/applications/hca/tests/config/householdInformation/veteranAnnualIncome.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/householdInformation/veteranAnnualIncome.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VeteranAnnualIncome config', () => {
const {
diff --git a/src/applications/hca/tests/config/insuranceInformation/general.unit.spec.jsx b/src/applications/hca/tests/unit/config/insuranceInformation/general.unit.spec.jsx
similarity index 97%
rename from src/applications/hca/tests/config/insuranceInformation/general.unit.spec.jsx
rename to src/applications/hca/tests/unit/config/insuranceInformation/general.unit.spec.jsx
index c4e66545a601..01e6eac58524 100644
--- a/src/applications/hca/tests/config/insuranceInformation/general.unit.spec.jsx
+++ b/src/applications/hca/tests/unit/config/insuranceInformation/general.unit.spec.jsx
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca GeneralInsurance config', () => {
const {
diff --git a/src/applications/hca/tests/config/insuranceInformation/medicaid.unit.spec.jsx b/src/applications/hca/tests/unit/config/insuranceInformation/medicaid.unit.spec.jsx
similarity index 94%
rename from src/applications/hca/tests/config/insuranceInformation/medicaid.unit.spec.jsx
rename to src/applications/hca/tests/unit/config/insuranceInformation/medicaid.unit.spec.jsx
index e0462c099644..71117126ea50 100644
--- a/src/applications/hca/tests/config/insuranceInformation/medicaid.unit.spec.jsx
+++ b/src/applications/hca/tests/unit/config/insuranceInformation/medicaid.unit.spec.jsx
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca Medicaid config', () => {
const {
diff --git a/src/applications/hca/tests/config/insuranceInformation/medicare.unit.spec.jsx b/src/applications/hca/tests/unit/config/insuranceInformation/medicare.unit.spec.jsx
similarity index 94%
rename from src/applications/hca/tests/config/insuranceInformation/medicare.unit.spec.jsx
rename to src/applications/hca/tests/unit/config/insuranceInformation/medicare.unit.spec.jsx
index 93edc0b18a6b..3f57c7d59da1 100644
--- a/src/applications/hca/tests/config/insuranceInformation/medicare.unit.spec.jsx
+++ b/src/applications/hca/tests/unit/config/insuranceInformation/medicare.unit.spec.jsx
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca Medicare config', () => {
const {
diff --git a/src/applications/hca/tests/config/insuranceInformation/medicarePartAEffectiveDate.unit.spec.jsx b/src/applications/hca/tests/unit/config/insuranceInformation/medicarePartAEffectiveDate.unit.spec.jsx
similarity index 95%
rename from src/applications/hca/tests/config/insuranceInformation/medicarePartAEffectiveDate.unit.spec.jsx
rename to src/applications/hca/tests/unit/config/insuranceInformation/medicarePartAEffectiveDate.unit.spec.jsx
index 94364f3f3893..e1275bbfd32d 100644
--- a/src/applications/hca/tests/config/insuranceInformation/medicarePartAEffectiveDate.unit.spec.jsx
+++ b/src/applications/hca/tests/unit/config/insuranceInformation/medicarePartAEffectiveDate.unit.spec.jsx
@@ -9,8 +9,8 @@ import {
submitForm,
getFormDOM,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca MedicarePartAEffectiveDate config', () => {
const {
diff --git a/src/applications/hca/tests/config/insuranceInformation/vaFacility_api.unit.spec.jsx b/src/applications/hca/tests/unit/config/insuranceInformation/vaFacility_api.unit.spec.jsx
similarity index 96%
rename from src/applications/hca/tests/config/insuranceInformation/vaFacility_api.unit.spec.jsx
rename to src/applications/hca/tests/unit/config/insuranceInformation/vaFacility_api.unit.spec.jsx
index 7bbc9fcb3289..ff1ddf67b47e 100644
--- a/src/applications/hca/tests/config/insuranceInformation/vaFacility_api.unit.spec.jsx
+++ b/src/applications/hca/tests/unit/config/insuranceInformation/vaFacility_api.unit.spec.jsx
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VaFacilityLighthouse config', () => {
const {
diff --git a/src/applications/hca/tests/config/insuranceInformation/vaFacility_json.unit.spec.jsx b/src/applications/hca/tests/unit/config/insuranceInformation/vaFacility_json.unit.spec.jsx
similarity index 96%
rename from src/applications/hca/tests/config/insuranceInformation/vaFacility_json.unit.spec.jsx
rename to src/applications/hca/tests/unit/config/insuranceInformation/vaFacility_json.unit.spec.jsx
index fe5cf2fdeb48..2afe42f1bb67 100644
--- a/src/applications/hca/tests/config/insuranceInformation/vaFacility_json.unit.spec.jsx
+++ b/src/applications/hca/tests/unit/config/insuranceInformation/vaFacility_json.unit.spec.jsx
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VaFacilityJson config', () => {
const {
diff --git a/src/applications/hca/tests/config/migrations.unit.spec.js b/src/applications/hca/tests/unit/config/migrations.unit.spec.js
similarity index 99%
rename from src/applications/hca/tests/config/migrations.unit.spec.js
rename to src/applications/hca/tests/unit/config/migrations.unit.spec.js
index ab756428490f..ad9a0dc83001 100644
--- a/src/applications/hca/tests/config/migrations.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/migrations.unit.spec.js
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import formConfig from '../../config/form';
+import formConfig from '../../../config/form';
describe('HCA migrations', () => {
const { migrations } = formConfig;
diff --git a/src/applications/hca/tests/config/militaryService/additionalInformation.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/additionalInformation.unit.spec.js
similarity index 92%
rename from src/applications/hca/tests/config/militaryService/additionalInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/militaryService/additionalInformation.unit.spec.js
index 589d9dfc8f64..fb86f40cf926 100644
--- a/src/applications/hca/tests/config/militaryService/additionalInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/militaryService/additionalInformation.unit.spec.js
@@ -8,9 +8,9 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
-describe('hca MilitaryServiceHistory config', () => {
+describe('hca Military Service History config', () => {
const {
schema,
uiSchema,
diff --git a/src/applications/hca/tests/unit/config/militaryService/agentOrangeExposure.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/agentOrangeExposure.unit.spec.js
new file mode 100644
index 000000000000..511b873bb6ad
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/agentOrangeExposure.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Agent Orange Exposure config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.agentOrangeExposure;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(2);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/unit/config/militaryService/combatOperationService.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/combatOperationService.unit.spec.js
new file mode 100644
index 000000000000..c034b76b7e97
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/combatOperationService.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Combat Operation Service config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.combatOperationService;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(2);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/unit/config/militaryService/gulfWarService.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/gulfWarService.unit.spec.js
new file mode 100644
index 000000000000..612ae1b2bb3b
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/gulfWarService.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Gulf War Service config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.gulfWarService;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(2);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/config/veteranInformation/birthInformation.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/gulfWarServiceDates.unit.spec.js
similarity index 86%
rename from src/applications/hca/tests/config/veteranInformation/birthInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/militaryService/gulfWarServiceDates.unit.spec.js
index 8c485fe91e5a..248e250f0702 100644
--- a/src/applications/hca/tests/config/veteranInformation/birthInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/militaryService/gulfWarServiceDates.unit.spec.js
@@ -8,13 +8,13 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
-describe('hca VeteranPlaceOfBirth config', () => {
+describe('hca Gulf War Service Dates config', () => {
const {
schema,
uiSchema,
- } = formConfig.chapters.veteranInformation.pages.birthInformation;
+ } = formConfig.chapters.militaryService.pages.gulfWarServiceDates;
const { defaultDefinitions: definitions } = formConfig;
it('should render', () => {
@@ -26,7 +26,7 @@ describe('hca VeteranPlaceOfBirth config', () => {
/>,
);
const formDOM = findDOMNode(form);
- expect(formDOM.querySelectorAll('input, select').length).to.equal(2);
+ expect(formDOM.querySelectorAll('input, select').length).to.equal(4);
});
it('should submit empty form', () => {
diff --git a/src/applications/hca/tests/unit/config/militaryService/otherToxicExposure.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/otherToxicExposure.unit.spec.js
new file mode 100644
index 000000000000..b22534bb9f95
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/otherToxicExposure.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Other Toxic Exposures config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.otherToxicExposure;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(10);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/unit/config/militaryService/otherToxicExposureDates.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/otherToxicExposureDates.unit.spec.js
new file mode 100644
index 000000000000..965fe47b3a54
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/otherToxicExposureDates.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Other Toxic Exposure Dates config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.otherToxicExposureDates;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input, select').length).to.equal(4);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/unit/config/militaryService/otherToxicExposureDetails.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/otherToxicExposureDetails.unit.spec.js
new file mode 100644
index 000000000000..addeff2bfd80
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/otherToxicExposureDetails.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Other Toxic Exposure Details config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.otherToxicExposureDetails;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(1);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/unit/config/militaryService/radiationCleanup.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/radiationCleanup.unit.spec.js
new file mode 100644
index 000000000000..434f734614e0
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/radiationCleanup.unit.spec.js
@@ -0,0 +1,48 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca Radiation Cleanup Efforts config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.radiationCleanup;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(2);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/config/militaryService/serviceInformation.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/serviceInformation.unit.spec.js
similarity index 97%
rename from src/applications/hca/tests/config/militaryService/serviceInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/militaryService/serviceInformation.unit.spec.js
index bb0c703005a5..c8d06c3dd340 100644
--- a/src/applications/hca/tests/config/militaryService/serviceInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/militaryService/serviceInformation.unit.spec.js
@@ -8,10 +8,10 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
-describe('hca MilitaryServiceInformation config', () => {
+describe('hca Military Service Information config', () => {
const {
schema,
uiSchema,
diff --git a/src/applications/hca/tests/unit/config/militaryService/toxicExposure.unit.spec.js b/src/applications/hca/tests/unit/config/militaryService/toxicExposure.unit.spec.js
new file mode 100644
index 000000000000..2d35525057b9
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/militaryService/toxicExposure.unit.spec.js
@@ -0,0 +1,68 @@
+import React from 'react';
+import { findDOMNode } from 'react-dom';
+import { expect } from 'chai';
+import sinon from 'sinon';
+import ReactTestUtils from 'react-dom/test-utils';
+
+import {
+ DefinitionTester,
+ submitForm,
+} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
+
+describe('hca Toxic Exposure config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.militaryService.pages.toxicExposure;
+ const { defaultDefinitions: definitions } = formConfig;
+
+ it('should render', () => {
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ expect(formDOM.querySelectorAll('input').length).to.equal(2);
+ });
+
+ it('should not submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(1);
+ expect(onSubmit.called).to.be.false;
+ });
+
+ it('should submit with valid data', () => {
+ const onSubmit = sinon.spy();
+ const form = ReactTestUtils.renderIntoDocument(
+ ,
+ );
+ const formDOM = findDOMNode(form);
+
+ simulateInputChange(formDOM, '#root_hasTeraResponseYes', 'Y');
+ submitForm(form);
+
+ expect(formDOM.querySelectorAll('.usa-input-error').length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/config/vaBenefits/basicInformation.unit.spec.js b/src/applications/hca/tests/unit/config/vaBenefits/basicInformation.unit.spec.js
similarity index 94%
rename from src/applications/hca/tests/config/vaBenefits/basicInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/vaBenefits/basicInformation.unit.spec.js
index 15784b9249d0..2aea695af7b2 100644
--- a/src/applications/hca/tests/config/vaBenefits/basicInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/vaBenefits/basicInformation.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VaCompensationType config', () => {
const { schema, uiSchema } = formConfig.chapters.vaBenefits.pages.vaBenefits;
diff --git a/src/applications/hca/tests/config/vaBenefits/pensionInformation.unit.spec.js b/src/applications/hca/tests/unit/config/vaBenefits/pensionInformation.unit.spec.js
similarity index 94%
rename from src/applications/hca/tests/config/vaBenefits/pensionInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/vaBenefits/pensionInformation.unit.spec.js
index 130ac347445d..e6cab7323ce9 100644
--- a/src/applications/hca/tests/config/vaBenefits/pensionInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/vaBenefits/pensionInformation.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VaPension config', () => {
const { schema, uiSchema } = formConfig.chapters.vaBenefits.pages.vaPension;
diff --git a/src/applications/hca/tests/unit/config/veteranInformation/birthInformation.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/birthInformation.unit.spec.js
new file mode 100644
index 000000000000..86dfae3eeabd
--- /dev/null
+++ b/src/applications/hca/tests/unit/config/veteranInformation/birthInformation.unit.spec.js
@@ -0,0 +1,62 @@
+import React from 'react';
+import { Provider } from 'react-redux';
+import { render, fireEvent } from '@testing-library/react';
+import { expect } from 'chai';
+import sinon from 'sinon';
+
+import { DefinitionTester } from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
+import formConfig from '../../../../config/form';
+
+describe('hca VeteranPlaceOfBirth config', () => {
+ const {
+ schema,
+ uiSchema,
+ } = formConfig.chapters.veteranInformation.pages.birthInformation;
+ const { defaultDefinitions: definitions } = formConfig;
+ const getData = ({ data = {} }) => ({
+ mockStore: {
+ getState: () => ({
+ form: { data },
+ }),
+ subscribe: () => {},
+ dispatch: () => {},
+ },
+ });
+
+ it('should render', () => {
+ const { mockStore } = getData({});
+ const { container } = render(
+
+
+ ,
+ );
+ expect(container.querySelectorAll('input, select').length).to.equal(2);
+ });
+
+ it('should submit empty form', () => {
+ const onSubmit = sinon.spy();
+ const { mockStore } = getData({});
+ const { container } = render(
+
+
+ ,
+ );
+ const selectors = {
+ errors: container.querySelectorAll('.usa-input-error'),
+ submitBtn: container.querySelector('button[type="submit"]'),
+ };
+ fireEvent.click(selectors.submitBtn);
+
+ expect(selectors.errors.length).to.equal(0);
+ expect(onSubmit.called).to.be.true;
+ });
+});
diff --git a/src/applications/hca/tests/config/veteranInformation/birthSex.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/birthSex.unit.spec.js
similarity index 94%
rename from src/applications/hca/tests/config/veteranInformation/birthSex.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/birthSex.unit.spec.js
index a13f2d61873e..38b7043f79cc 100644
--- a/src/applications/hca/tests/config/veteranInformation/birthSex.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/birthSex.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VeteranBirthSex config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/contactInformation.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/contactInformation.unit.spec.js
similarity index 96%
rename from src/applications/hca/tests/config/veteranInformation/contactInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/contactInformation.unit.spec.js
index e9dd8e8fae27..25e7227e7151 100644
--- a/src/applications/hca/tests/config/veteranInformation/contactInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/contactInformation.unit.spec.js
@@ -8,7 +8,7 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
describe('hca VeteranContactInformation config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/demographicInformation.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/demographicInformation.unit.spec.js
similarity index 96%
rename from src/applications/hca/tests/config/veteranInformation/demographicInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/demographicInformation.unit.spec.js
index 2278c67bf7a6..3767652fb24f 100644
--- a/src/applications/hca/tests/config/veteranInformation/demographicInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/demographicInformation.unit.spec.js
@@ -8,7 +8,7 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
describe('hca VeteranDemographicInformation config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/maidenNameInformation.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/maidenNameInformation.unit.spec.js
similarity index 96%
rename from src/applications/hca/tests/config/veteranInformation/maidenNameInformation.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/maidenNameInformation.unit.spec.js
index 32a21fe6ec0b..cfbf61617175 100644
--- a/src/applications/hca/tests/config/veteranInformation/maidenNameInformation.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/maidenNameInformation.unit.spec.js
@@ -8,7 +8,7 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
describe('hca VeteranMaidenNameInformation config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/veteranAddress.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/veteranAddress.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/veteranInformation/veteranAddress.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/veteranAddress.unit.spec.js
index abccb4055f67..5fad51e3f222 100644
--- a/src/applications/hca/tests/config/veteranInformation/veteranAddress.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/veteranAddress.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VeteranAddress config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/veteranDateOfBirth.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/veteranDateOfBirth.unit.spec.js
similarity index 97%
rename from src/applications/hca/tests/config/veteranInformation/veteranDateOfBirth.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/veteranDateOfBirth.unit.spec.js
index 067c915ae84d..78ed6a26e98b 100644
--- a/src/applications/hca/tests/config/veteranInformation/veteranDateOfBirth.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/veteranDateOfBirth.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VeteranDateOfBirth config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/veteranGender.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/veteranGender.unit.spec.js
similarity index 96%
rename from src/applications/hca/tests/config/veteranInformation/veteranGender.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/veteranGender.unit.spec.js
index 0cc299ead61f..a2b687786f11 100644
--- a/src/applications/hca/tests/config/veteranInformation/veteranGender.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/veteranGender.unit.spec.js
@@ -8,7 +8,7 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
+import formConfig from '../../../../config/form';
describe('hca VeteranGenderIdentity config', () => {
const {
diff --git a/src/applications/hca/tests/config/veteranInformation/veteranHomeAddress.unit.spec.js b/src/applications/hca/tests/unit/config/veteranInformation/veteranHomeAddress.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/config/veteranInformation/veteranHomeAddress.unit.spec.js
rename to src/applications/hca/tests/unit/config/veteranInformation/veteranHomeAddress.unit.spec.js
index 2f43a600edb6..9f6697b637c0 100644
--- a/src/applications/hca/tests/config/veteranInformation/veteranHomeAddress.unit.spec.js
+++ b/src/applications/hca/tests/unit/config/veteranInformation/veteranHomeAddress.unit.spec.js
@@ -8,8 +8,8 @@ import {
DefinitionTester,
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../../config/form';
-import { simulateInputChange } from '../../helpers';
+import formConfig from '../../../../config/form';
+import { simulateInputChange } from '../../../helpers';
describe('hca VeteranHomeAddress config', () => {
const {
diff --git a/src/applications/hca/tests/definitions/dependent.unit.spec.js b/src/applications/hca/tests/unit/definitions/dependent.unit.spec.js
similarity index 98%
rename from src/applications/hca/tests/definitions/dependent.unit.spec.js
rename to src/applications/hca/tests/unit/definitions/dependent.unit.spec.js
index 803a82aa2cfa..79ccc147f0d9 100644
--- a/src/applications/hca/tests/definitions/dependent.unit.spec.js
+++ b/src/applications/hca/tests/unit/definitions/dependent.unit.spec.js
@@ -9,12 +9,12 @@ import {
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../config/form';
-import { simulateInputChange } from '../helpers';
+import formConfig from '../../../config/form';
+import { simulateInputChange } from '../../helpers';
import {
dependentSchema,
dependentUISchema,
-} from '../../definitions/dependent';
+} from '../../../definitions/dependent';
describe('hca Dependent config', () => {
const { defaultDefinitions: definitions } = formConfig;
diff --git a/src/applications/hca/tests/definitions/idForm.unit.spec.js b/src/applications/hca/tests/unit/definitions/idForm.unit.spec.js
similarity index 93%
rename from src/applications/hca/tests/definitions/idForm.unit.spec.js
rename to src/applications/hca/tests/unit/definitions/idForm.unit.spec.js
index 4d47bc5fbe81..1691e93a04e9 100644
--- a/src/applications/hca/tests/definitions/idForm.unit.spec.js
+++ b/src/applications/hca/tests/unit/definitions/idForm.unit.spec.js
@@ -9,12 +9,12 @@ import {
submitForm,
} from '@department-of-veterans-affairs/platform-testing/schemaform-utils';
-import formConfig from '../../config/form';
-import { simulateInputChange } from '../helpers';
+import formConfig from '../../../config/form';
+import { simulateInputChange } from '../../helpers';
import {
idFormSchema as schema,
idFormUiSchema as uiSchema,
-} from '../../definitions/idForm';
+} from '../../../definitions/idForm';
describe('hca IDForm config', () => {
const { defaultDefinitions: definitions } = formConfig;
diff --git a/src/applications/hca/tests/reducers/enrollment-status.unit.spec.js b/src/applications/hca/tests/unit/reducers/enrollment-status.unit.spec.js
similarity index 98%
rename from src/applications/hca/tests/reducers/enrollment-status.unit.spec.js
rename to src/applications/hca/tests/unit/reducers/enrollment-status.unit.spec.js
index 3ec4f21121d3..a25ca0c82e01 100644
--- a/src/applications/hca/tests/reducers/enrollment-status.unit.spec.js
+++ b/src/applications/hca/tests/unit/reducers/enrollment-status.unit.spec.js
@@ -1,7 +1,7 @@
import { expect } from 'chai';
-import { ENROLLMENT_STATUS_ACTIONS } from '../../utils/constants';
-import reducer from '../../reducers/enrollment-status';
+import { ENROLLMENT_STATUS_ACTIONS } from '../../../utils/constants';
+import reducer from '../../../reducers/enrollment-status';
describe('hca EnrollmentStatus reducer', () => {
let state;
diff --git a/src/applications/hca/tests/reducers/total-disabilities.unit.spec.js b/src/applications/hca/tests/unit/reducers/total-disabilities.unit.spec.js
similarity index 95%
rename from src/applications/hca/tests/reducers/total-disabilities.unit.spec.js
rename to src/applications/hca/tests/unit/reducers/total-disabilities.unit.spec.js
index f18869e33e82..d0849088eb0b 100644
--- a/src/applications/hca/tests/reducers/total-disabilities.unit.spec.js
+++ b/src/applications/hca/tests/unit/reducers/total-disabilities.unit.spec.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
-import { DISABILITY_RATING_ACTIONS } from '../../utils/constants';
-import reducer from '../../reducers/total-disabilities';
+import { DISABILITY_RATING_ACTIONS } from '../../../utils/constants';
+import reducer from '../../../reducers/total-disabilities';
describe('hca TotalDisabilities reducer', () => {
let state;
diff --git a/src/applications/hca/tests/utils/actions.unit.spec.js b/src/applications/hca/tests/unit/utils/actions.unit.spec.js
similarity index 98%
rename from src/applications/hca/tests/utils/actions.unit.spec.js
rename to src/applications/hca/tests/unit/utils/actions.unit.spec.js
index 1241171bae57..7764a3748ca6 100644
--- a/src/applications/hca/tests/utils/actions.unit.spec.js
+++ b/src/applications/hca/tests/unit/utils/actions.unit.spec.js
@@ -12,8 +12,8 @@ import {
setDismissedHCANotification,
getEnrollmentStatus,
resetEnrollmentStatus,
-} from '../../utils/actions';
-import { ENROLLMENT_STATUS_ACTIONS } from '../../utils/constants';
+} from '../../../utils/actions';
+import { ENROLLMENT_STATUS_ACTIONS } from '../../../utils/constants';
describe('hca actions', () => {
const {
diff --git a/src/applications/hca/tests/unit/utils/helpers/form-config.unit.spec.js b/src/applications/hca/tests/unit/utils/helpers/form-config.unit.spec.js
new file mode 100644
index 000000000000..775f73dc841c
--- /dev/null
+++ b/src/applications/hca/tests/unit/utils/helpers/form-config.unit.spec.js
@@ -0,0 +1,500 @@
+import { expect } from 'chai';
+
+import {
+ isLoggedOut,
+ hasLowDisabilityRating,
+ hasHighCompensation,
+ hasNoCompensation,
+ notShortFormEligible,
+ dischargePapersRequired,
+ isMissingVeteranDob,
+ isSigiEnabled,
+ hasDifferentHomeAddress,
+ teraInformationEnabled,
+ includeTeraInformation,
+ includeGulfWarServiceDates,
+ includeOtherExposureDates,
+ includeOtherExposureDetails,
+ showFinancialConfirmation,
+ includeHouseholdInformation,
+ includeSpousalInformation,
+ spouseDidNotCohabitateWithVeteran,
+ spouseAddressDoesNotMatchVeterans,
+ includeDependentInformation,
+ collectMedicareInformation,
+ useLighthouseFacilityList,
+ useJsonFacilityList,
+} from '../../../../utils/helpers/form-config';
+import {
+ DEPENDENT_VIEW_FIELDS,
+ HIGH_DISABILITY_MINIMUM,
+} from '../../../../utils/constants';
+
+describe('hca form config helpers', () => {
+ context('when `isLoggedOut` executes', () => {
+ const getData = ({ loggedIn = true }) => ({
+ 'view:isLoggedIn': loggedIn,
+ });
+
+ it('should return `false` when user is authenticated', () => {
+ const formData = getData({});
+ expect(isLoggedOut(formData)).to.be.false;
+ });
+
+ it('should return `true` when user is unauthenticated', () => {
+ const formData = getData({ loggedIn: false });
+ expect(isLoggedOut(formData)).to.be.true;
+ });
+ });
+
+ context('when `hasLowDisabilityRating` executes', () => {
+ const getData = ({ rating = 0 }) => ({
+ 'view:totalDisabilityRating': rating,
+ });
+
+ it('should return `false` when rating is greater than or equal to the minimum', () => {
+ const formData = getData({ rating: 80 });
+ expect(hasLowDisabilityRating(formData)).to.be.false;
+ });
+
+ it('should return `true` when rating is less than to the minimum', () => {
+ const formData = getData({});
+ expect(hasLowDisabilityRating(formData)).to.be.true;
+ });
+ });
+
+ context('when `hasHighCompensation` executes', () => {
+ const getData = ({ type = 'none' }) => ({
+ vaCompensationType: type,
+ });
+
+ it('should return `false` when compensation type is not `highDisability`', () => {
+ const formData = getData({});
+ expect(hasHighCompensation(formData)).to.be.false;
+ });
+
+ it('should return `true` when compensation type is `highDisability`', () => {
+ const formData = getData({ type: 'highDisability' });
+ expect(hasHighCompensation(formData)).to.be.true;
+ });
+ });
+
+ context('when `hasNoCompensation` executes', () => {
+ const getData = ({ type = 'highDisability' }) => ({
+ vaCompensationType: type,
+ });
+
+ it('should return `false` when compensation type is not `none`', () => {
+ const formData = getData({});
+ expect(hasNoCompensation(formData)).to.be.false;
+ });
+
+ it('should return `true` when compensation type is `none`', () => {
+ const formData = getData({ type: 'none' });
+ expect(hasNoCompensation(formData)).to.be.true;
+ });
+ });
+
+ context('when `notShortFormEligible` executes ', () => {
+ const getData = ({ compensation = 'none', rating = 0 }) => ({
+ vaCompensationType: compensation,
+ 'view:totalDisabilityRating': rating,
+ });
+
+ context('when disability rating is less than the minimum', () => {
+ it('should return `true` when compensation type is not `highDisability`', () => {
+ const formData = getData({});
+ expect(notShortFormEligible(formData)).to.be.true;
+ });
+
+ it('should return `false` when compensation type is `highDisability`', () => {
+ const formData = getData({ compensation: 'highDisability' });
+ expect(notShortFormEligible(formData)).to.be.false;
+ });
+ });
+
+ context('when disability rating is greater or equal to the minimum', () => {
+ it('should return `false`', () => {
+ const formData = getData({ rating: HIGH_DISABILITY_MINIMUM });
+ expect(notShortFormEligible(formData)).to.be.false;
+ });
+ });
+ });
+
+ context('when `dischargePapersRequired` executes', () => {
+ const getData = ({ inMvi = true, disabilityRating = 0 }) => ({
+ 'view:totalDisabilityRating': disabilityRating,
+ 'view:isUserInMvi': inMvi,
+ });
+
+ it('should return `false` when user is found in MVI/MPI', () => {
+ const formData = getData({});
+ expect(dischargePapersRequired(formData)).to.be.false;
+ });
+
+ it('should return `true` when user is NOT found in MVI/MPI', () => {
+ const formData = getData({ inMvi: false });
+ expect(dischargePapersRequired(formData)).to.be.true;
+ });
+
+ it('should return `false` when user is short form eligible', () => {
+ const formData = getData({ disabilityRating: 80 });
+ expect(dischargePapersRequired(formData)).to.be.false;
+ });
+ });
+
+ context('when `isMissingVeteranDob` executes', () => {
+ it('should return `true` when viewfield is `null`', () => {
+ const formData = { 'view:isLoggedIn': true, 'view:userDob': null };
+ expect(isMissingVeteranDob(formData)).to.be.true;
+ });
+
+ it('should return `false` when viewfield is populated', () => {
+ const formData = {
+ 'view:isLoggedIn': true,
+ 'view:userDob': '1990-01-01',
+ };
+ expect(isMissingVeteranDob(formData)).to.be.false;
+ });
+ });
+
+ context('when `isSigiEnabled` executes', () => {
+ it('should return `true` when value is `true`', () => {
+ const formData = { 'view:isSigiEnabled': true };
+ expect(isSigiEnabled(formData)).to.be.true;
+ });
+
+ it('should return `false` when value is `false`', () => {
+ const formData = { 'view:isSigiEnabled': false };
+ expect(isSigiEnabled(formData)).to.be.false;
+ });
+ });
+
+ context('when `hasDifferentHomeAddress` executes', () => {
+ it('should return `false` when mailing matches home address', () => {
+ const formData = { 'view:doesMailingMatchHomeAddress': true };
+ expect(hasDifferentHomeAddress(formData)).to.be.false;
+ });
+
+ it('should return `true` when mailing does not match home address', () => {
+ const formData = { 'view:doesMailingMatchHomeAddress': false };
+ expect(hasDifferentHomeAddress(formData)).to.be.true;
+ });
+ });
+
+ context('when `teraInformationEnabled` executes', () => {
+ const getData = ({ enabled = false, disabilityRating = 0 }) => ({
+ 'view:totalDisabilityRating': disabilityRating,
+ 'view:isTeraEnabled': enabled,
+ });
+
+ it('should return `false` when feature flag is disabled', () => {
+ const formData = getData({});
+ expect(teraInformationEnabled(formData)).to.be.false;
+ });
+
+ it('should return `true` when feature flag is enabled', () => {
+ const formData = getData({ enabled: true });
+ expect(teraInformationEnabled(formData)).to.be.true;
+ });
+
+ it('should return `false` when user is short form eligible', () => {
+ const formData = getData({ disabilityRating: 80 });
+ expect(teraInformationEnabled(formData)).to.be.false;
+ });
+ });
+
+ context('when `includeTeraInformation` executes', () => {
+ const getData = ({ response = null, enabled = true }) => ({
+ 'view:totalDisabilityRating': 0,
+ 'view:isTeraEnabled': enabled,
+ hasTeraResponse: response,
+ });
+
+ it('should return `true` when response is `true`', () => {
+ const formData = getData({ response: true });
+ expect(includeTeraInformation(formData)).to.be.true;
+ });
+
+ it('should return `false` when response is `false`', () => {
+ const formData = getData({ response: false });
+ expect(includeTeraInformation(formData)).to.be.false;
+ });
+
+ it('should return `false` when feature flag is disabled', () => {
+ const formData = getData({ enabled: false });
+ expect(includeTeraInformation(formData)).to.be.false;
+ });
+ });
+
+ context('when `includeGulfWarServiceDates` executes', () => {
+ const getData = ({ response = null }) => ({
+ gulfWarService: response,
+ });
+
+ it('should return `true` when response is `true`', () => {
+ const formData = getData({ response: true });
+ expect(includeGulfWarServiceDates(formData)).to.be.true;
+ });
+
+ it('should return `false` when response is `false`', () => {
+ const formData = getData({ response: false });
+ expect(includeGulfWarServiceDates(formData)).to.be.false;
+ });
+ });
+
+ context('when `includeOtherExposureDates` executes', () => {
+ const getData = ({ exposures = {} }) => ({
+ 'view:otherToxicExposures': exposures,
+ });
+
+ it('should return `false` when form data does not include the data object', () => {
+ expect(includeOtherExposureDates({})).to.be.false;
+ });
+
+ it('should return `false` when the form data object is empty', () => {
+ const formData = getData({});
+ expect(includeOtherExposureDates(formData)).to.be.false;
+ });
+
+ it('should return `false` when the form data does not contain a truthy value', () => {
+ const formData = getData({ exposures: { a: false, b: false, c: false } });
+ expect(includeOtherExposureDates(formData)).to.be.false;
+ });
+
+ it('should return `true` when the form data contains a truthy value', () => {
+ const formData = getData({ exposures: { a: false, b: true, c: false } });
+ expect(includeOtherExposureDates(formData)).to.be.true;
+ });
+ });
+
+ context('when `includeOtherExposureDetails` executes', () => {
+ const getData = ({ exposures = {} }) => ({
+ 'view:otherToxicExposures': exposures,
+ });
+
+ it('should return `false` when the `exposureToOther` key is `false`', () => {
+ const formData = getData({ exposures: { exposureToOther: false } });
+ expect(includeOtherExposureDetails(formData)).to.be.false;
+ });
+
+ it('should return `true` when the `exposureToOther` key is `true`', () => {
+ const formData = getData({ exposures: { exposureToOther: true } });
+ expect(includeOtherExposureDetails(formData)).to.be.true;
+ });
+ });
+
+ context('when `showFinancialConfirmation` executes', () => {
+ const getData = ({ disabilityRating = 0, discloseFinancials = true }) => ({
+ 'view:totalDisabilityRating': disabilityRating,
+ discloseFinancialInformation: discloseFinancials,
+ });
+
+ context('when financial disclosure is `true`', () => {
+ it('should return `false`', () => {
+ const formData = getData({});
+ expect(showFinancialConfirmation(formData)).to.be.false;
+ });
+ });
+
+ context('when financial disclosure is `false`', () => {
+ it('should return `true`', () => {
+ const formData = getData({ discloseFinancials: false });
+ expect(showFinancialConfirmation(formData)).to.be.true;
+ });
+ });
+
+ context('when user is short form eligible', () => {
+ it('should return `false`', () => {
+ const formData = getData({ disabilityRating: 80 });
+ expect(showFinancialConfirmation(formData)).to.be.false;
+ });
+ });
+ });
+
+ context('when `includeHouseholdInformation` executes', () => {
+ const getData = ({ disabilityRating = 0, discloseFinancials = true }) => ({
+ 'view:totalDisabilityRating': disabilityRating,
+ discloseFinancialInformation: discloseFinancials,
+ });
+
+ context('when financial disclosure is `true`', () => {
+ it('should return `true`', () => {
+ const formData = getData({});
+ expect(includeHouseholdInformation(formData)).to.be.true;
+ });
+ });
+
+ context('when financial disclosure is `false`', () => {
+ it('should return `false`', () => {
+ const formData = getData({ discloseFinancials: false });
+ expect(includeHouseholdInformation(formData)).to.be.false;
+ });
+ });
+
+ context('when user is short form eligible', () => {
+ it('should return `false`', () => {
+ const formData = getData({ disabilityRating: 80 });
+ expect(includeHouseholdInformation(formData)).to.be.false;
+ });
+ });
+ });
+
+ context('when `includeSpousalInformation` executes', () => {
+ const getData = ({
+ disabilityRating = 0,
+ discloseFinancials = true,
+ maritalStatus = 'never married',
+ }) => ({
+ 'view:totalDisabilityRating': disabilityRating,
+ discloseFinancialInformation: discloseFinancials,
+ maritalStatus,
+ });
+
+ context('when financial disclosure is `true`', () => {
+ it('should return `false` when marital status is `never married`', () => {
+ const formData = getData({});
+ expect(includeSpousalInformation(formData)).to.be.false;
+ });
+
+ it('should return `true` when marital status is `married`', () => {
+ const formData = getData({ maritalStatus: 'married' });
+ expect(includeSpousalInformation(formData)).to.be.true;
+ });
+
+ it('should return `true` when marital status is `separated`', () => {
+ const formData = getData({ maritalStatus: 'separated' });
+ expect(includeSpousalInformation(formData)).to.be.true;
+ });
+ });
+
+ context('when financial disclosure is `false`', () => {
+ it('should return `false`', () => {
+ const formData = getData({ discloseFinancials: false });
+ expect(includeSpousalInformation(formData)).to.be.false;
+ });
+ });
+
+ context('when user is short form eligible', () => {
+ it('should return `false`', () => {
+ const formData = getData({ disabilityRating: 80 });
+ expect(includeSpousalInformation(formData)).to.be.false;
+ });
+ });
+ });
+
+ context('when `spouseDidNotCohabitateWithVeteran` executes', () => {
+ const getData = ({ status = 'married', cohabitated = null }) => ({
+ formData: {
+ 'view:totalDisabilityRating': 0,
+ discloseFinancialInformation: true,
+ cohabitedLastYear: cohabitated,
+ maritalStatus: status,
+ },
+ });
+
+ it('should return `false` when Veteran was not married or legally separarted', () => {
+ const { formData } = getData({ status: 'not married' });
+ expect(spouseDidNotCohabitateWithVeteran(formData)).to.be.false;
+ });
+
+ it('should return `false` when spouse did cohabitate with Veteran', () => {
+ const { formData } = getData({ cohabitated: true });
+ expect(spouseDidNotCohabitateWithVeteran(formData)).to.be.false;
+ });
+
+ it('should return `true` when spouse did not cohabitate with Veteran', () => {
+ const { formData } = getData({ cohabitated: false });
+ expect(spouseDidNotCohabitateWithVeteran(formData)).to.be.true;
+ });
+ });
+
+ context('when `spouseAddressDoesNotMatchVeterans` executes', () => {
+ const getData = ({ status = 'married', sameAddress = null }) => ({
+ formData: {
+ 'view:totalDisabilityRating': 0,
+ discloseFinancialInformation: true,
+ maritalStatus: status,
+ sameAddress,
+ },
+ });
+
+ it('should return `false` when Veteran was not married or legally separarted', () => {
+ const { formData } = getData({ status: 'not married' });
+ expect(spouseAddressDoesNotMatchVeterans(formData)).to.be.false;
+ });
+
+ it('should return `false` when spouse address matches Veteran', () => {
+ const { formData } = getData({ sameAddress: true });
+ expect(spouseAddressDoesNotMatchVeterans(formData)).to.be.false;
+ });
+
+ it('should return `true` when spouse address does not match Veteran', () => {
+ const { formData } = getData({ sameAddress: false });
+ expect(spouseAddressDoesNotMatchVeterans(formData)).to.be.true;
+ });
+ });
+
+ context('when `includeDependentInformation` executes', () => {
+ const getData = ({ skip }) => ({
+ formData: {
+ 'view:totalDisabilityRating': 0,
+ discloseFinancialInformation: true,
+ [DEPENDENT_VIEW_FIELDS.skip]: skip,
+ },
+ });
+
+ it('should return `false` when skip value is `true`', () => {
+ const { formData } = getData({ skip: true });
+ expect(includeDependentInformation(formData)).to.be.false;
+ });
+
+ it('should return `true` when skip value is `false`', () => {
+ const { formData } = getData({ skip: false });
+ expect(includeDependentInformation(formData)).to.be.true;
+ });
+ });
+
+ context('when `collectMedicareInformation` executes', () => {
+ const getData = ({ enrolled = null }) => ({
+ formData: {
+ 'view:totalDisabilityRating': 0,
+ isEnrolledMedicarePartA: enrolled,
+ },
+ });
+
+ it('should return `true` when Veteran is enrolled in Medicare', () => {
+ const { formData } = getData({ enrolled: true });
+ expect(collectMedicareInformation(formData)).to.be.true;
+ });
+
+ it('should return `false` when Veteran is not enrolled in Medicare', () => {
+ const { formData } = getData({ enrolled: false });
+ expect(collectMedicareInformation(formData)).to.be.false;
+ });
+ });
+
+ context('when `useLighthouseFacilityList` executes', () => {
+ it('should return `true` when viewfield is set to `true`', () => {
+ const formData = { 'view:isFacilitiesApiEnabled': true };
+ expect(useLighthouseFacilityList(formData)).to.be.true;
+ });
+
+ it('should return `false` when viewfield is set to `false`', () => {
+ const formData = { 'view:isFacilitiesApiEnabled': false };
+ expect(useLighthouseFacilityList(formData)).to.be.false;
+ });
+ });
+
+ context('when `useJsonFacilityList` executes', () => {
+ it('should return `false` when viewfield is set to `true`', () => {
+ const formData = { 'view:isFacilitiesApiEnabled': true };
+ expect(useJsonFacilityList(formData)).to.be.false;
+ });
+
+ it('should return `true` when viewfield is set to `false`', () => {
+ const formData = { 'view:isFacilitiesApiEnabled': false };
+ expect(useJsonFacilityList(formData)).to.be.true;
+ });
+ });
+});
diff --git a/src/applications/hca/tests/utils/helpers.unit.spec.js b/src/applications/hca/tests/unit/utils/helpers/helpers.unit.spec.js
similarity index 89%
rename from src/applications/hca/tests/utils/helpers.unit.spec.js
rename to src/applications/hca/tests/unit/utils/helpers/helpers.unit.spec.js
index ea6b540a615d..cf265192cc69 100644
--- a/src/applications/hca/tests/utils/helpers.unit.spec.js
+++ b/src/applications/hca/tests/unit/utils/helpers/helpers.unit.spec.js
@@ -4,8 +4,6 @@ import {
didEnrollmentStatusChange,
transformAttachments,
prefillTransformer,
- isShortFormEligible,
- includeSpousalInformation,
getInsuranceAriaLabel,
isOfCollegeAge,
getDependentPageList,
@@ -15,8 +13,7 @@ import {
getSearchAction,
getSearchIndex,
getDefaultState,
-} from '../../utils/helpers';
-import { HIGH_DISABILITY_MINIMUM } from '../../utils/constants';
+} from '../../../../utils/helpers';
describe('hca helpers', () => {
describe('when `prefillTransformer` executes', () => {
@@ -253,93 +250,6 @@ describe('hca helpers', () => {
});
});
- describe('when `isShortFormEligible` executes ', () => {
- const formData = {
- vaCompensationType: 'none',
- 'view:totalDisabilityRating': 0,
- };
-
- describe('when disability rating is less than the high-disability minimum', () => {
- describe('when compensation type is not `highDisability`', () => {
- it('should return `false`', () => {
- expect(isShortFormEligible(formData)).to.be.false;
- });
- });
-
- describe('when compensation type is `highDisability`', () => {
- it('should return `true`', () => {
- expect(
- isShortFormEligible({
- ...formData,
- vaCompensationType: 'highDisability',
- }),
- ).to.be.true;
- });
- });
- });
-
- describe('when disability rating is greater or equal to the high-disability minimum', () => {
- it('should return `true`', () => {
- expect(
- isShortFormEligible({
- ...formData,
- 'view:totalDisabilityRating': HIGH_DISABILITY_MINIMUM,
- }),
- ).to.be.true;
- });
- });
- });
-
- describe('when `includeSpousalInformation` executes', () => {
- const formData = {
- discloseFinancialInformation: false,
- maritalStatus: 'never married',
- };
-
- describe('when financial disclose is `false`', () => {
- it('should return `false`', () => {
- expect(includeSpousalInformation(formData)).to.be.false;
- });
- });
-
- describe('when financial disclosure is `true`', () => {
- describe('when marital status is `never married`', () => {
- it('should return `false`', () => {
- expect(
- includeSpousalInformation({
- ...formData,
- discloseFinancialInformation: true,
- }),
- ).to.be.false;
- });
- });
-
- describe('when marital status is `married`', () => {
- it('should return `true`', () => {
- expect(
- includeSpousalInformation({
- ...formData,
- discloseFinancialInformation: true,
- maritalStatus: 'married',
- }),
- ).to.be.true;
- });
- });
-
- describe('when marital status is `separated`', () => {
- it('should return `true`', () => {
- expect(
- includeSpousalInformation({
- ...formData,
- discloseFinancialInformation: true,
- maritalStatus: 'separated',
- }),
- ).to.be.true;
- });
- });
- });
- });
-
describe('when `getInsuranceAriaLabel` executes', () => {
describe('when the provider name is not provided', () => {
it('should return a generic label', () => {
diff --git a/src/applications/hca/tests/utils/selectors/datadog-rum.unit.spec.js b/src/applications/hca/tests/unit/utils/selectors/datadog-rum.unit.spec.js
similarity index 90%
rename from src/applications/hca/tests/utils/selectors/datadog-rum.unit.spec.js
rename to src/applications/hca/tests/unit/utils/selectors/datadog-rum.unit.spec.js
index 057f0e2acd2a..a28dc2e0491c 100644
--- a/src/applications/hca/tests/utils/selectors/datadog-rum.unit.spec.js
+++ b/src/applications/hca/tests/unit/utils/selectors/datadog-rum.unit.spec.js
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-import { selectRumUser } from '../../../utils/selectors/datadog-rum';
+import { selectRumUser } from '../../../../utils/selectors/datadog-rum';
describe('hca DatadogRUM selector', () => {
const state = {
diff --git a/src/applications/hca/tests/utils/selectors/feature-toggles.unit.spec.js b/src/applications/hca/tests/unit/utils/selectors/feature-toggles.unit.spec.js
similarity index 83%
rename from src/applications/hca/tests/utils/selectors/feature-toggles.unit.spec.js
rename to src/applications/hca/tests/unit/utils/selectors/feature-toggles.unit.spec.js
index da39ae40a778..f27f7f6b18cc 100644
--- a/src/applications/hca/tests/utils/selectors/feature-toggles.unit.spec.js
+++ b/src/applications/hca/tests/unit/utils/selectors/feature-toggles.unit.spec.js
@@ -1,11 +1,12 @@
import { expect } from 'chai';
-import { selectFeatureToggles } from '../../../utils/selectors/feature-toggles';
+import { selectFeatureToggles } from '../../../../utils/selectors/feature-toggles';
describe('hca FeatureToggles selector', () => {
const state = {
featureToggles: {
/* eslint-disable camelcase */
hca_sigi_enabled: false,
+ hca_tera_enabled: true,
hca_browser_monitoring_enabled: true,
hca_enrollment_status_override_enabled: false,
hca_use_facilities_API: false,
@@ -21,6 +22,7 @@ describe('hca FeatureToggles selector', () => {
isESOverrideEnabled: false,
isFacilitiesApiEnabled: false,
isSigiEnabled: false,
+ isTeraEnabled: true,
});
});
});
diff --git a/src/applications/hca/tests/utils/selectors/selectors.unit.spec.js b/src/applications/hca/tests/unit/utils/selectors/selectors.unit.spec.js
similarity index 99%
rename from src/applications/hca/tests/utils/selectors/selectors.unit.spec.js
rename to src/applications/hca/tests/unit/utils/selectors/selectors.unit.spec.js
index 4c92a819920c..15f22893520b 100644
--- a/src/applications/hca/tests/utils/selectors/selectors.unit.spec.js
+++ b/src/applications/hca/tests/unit/utils/selectors/selectors.unit.spec.js
@@ -1,6 +1,6 @@
import { expect } from 'chai';
-import * as selectors from '../../../utils/selectors';
-import { HCA_ENROLLMENT_STATUSES } from '../../../utils/constants';
+import * as selectors from '../../../../utils/selectors';
+import { HCA_ENROLLMENT_STATUSES } from '../../../../utils/constants';
const basicEnrollmentStatusState = {
applicationDate: null,
diff --git a/src/applications/hca/tests/unit/utils/validation.unit.spec.js b/src/applications/hca/tests/unit/utils/validation.unit.spec.js
new file mode 100644
index 000000000000..d3e62c68debf
--- /dev/null
+++ b/src/applications/hca/tests/unit/utils/validation.unit.spec.js
@@ -0,0 +1,274 @@
+import { expect } from 'chai';
+import sinon from 'sinon';
+import moment from 'moment';
+
+import {
+ validateServiceDates,
+ validateDependentDate,
+ validateGulfWarDates,
+ validateExposureDates,
+ validateCurrency,
+} from '../../../utils/validation';
+
+describe('hca `validateServiceDates` form validation', () => {
+ const getData = ({
+ spy = () => {},
+ errorKey = 'lastDischargeDate',
+ dischargeDate = '2016-01-01',
+ entryDate = '2011-01-01',
+ birthdate = '1980-01-01',
+ }) => ({
+ errors: {
+ [errorKey]: { addError: spy },
+ },
+ fieldData: {
+ lastDischargeDate: dischargeDate,
+ lastEntryDate: entryDate,
+ },
+ formData: {
+ veteranDateOfBirth: birthdate,
+ },
+ });
+
+ context('when form data is valid', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({ spy });
+
+ it('should not set error message', () => {
+ validateServiceDates(errors, fieldData, formData);
+ expect(spy.called).to.be.false;
+ });
+ });
+
+ context('when discharge date is before entry date', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({
+ dischargeDate: '2010-01-01',
+ spy,
+ });
+
+ it('should set error message ', () => {
+ validateServiceDates(errors, fieldData, formData);
+ expect(spy.called).to.be.true;
+ });
+ });
+
+ context('when discharge date is later than 1 year from today', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({
+ dischargeDate: moment()
+ .add(367, 'days')
+ .format('YYYY-MM-DD'),
+ spy,
+ });
+
+ it('should set error message', () => {
+ validateServiceDates(errors, fieldData, formData);
+ expect(spy.called).to.be.true;
+ });
+ });
+
+ context('when discharge date is exactly 1 year from today', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({
+ dischargeDate: moment()
+ .add(1, 'year')
+ .format('YYYY-MM-DD'),
+ spy,
+ });
+
+ it('should not set message ', () => {
+ validateServiceDates(errors, fieldData, formData);
+ expect(spy.called).to.be.false;
+ });
+ });
+
+ context('when entry date is less than 15 years after birthdate', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({
+ errorKey: 'lastEntryDate',
+ dischargeDate: '2010-03-01',
+ entryDate: '2000-01-01',
+ birthdate: '1990-01-01',
+ spy,
+ });
+
+ it('should set error message ', () => {
+ validateServiceDates(errors, fieldData, formData);
+ expect(spy.called).to.be.true;
+ });
+ });
+});
+
+describe('hca `validateGulfWarDates` form validation', () => {
+ const getData = ({
+ spy = () => {},
+ startDate = '1990-09-XX',
+ endDate = '1991-01-XX',
+ }) => ({
+ errors: {
+ gulfWarEndDate: {
+ addError: spy,
+ },
+ },
+ fieldData: {
+ gulfWarStartDate: startDate,
+ gulfWarEndDate: endDate,
+ },
+ });
+
+ context('when form data is valid', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData } = getData({ spy });
+
+ it('should not set error message', () => {
+ validateGulfWarDates(errors, fieldData);
+ expect(spy.called).to.be.false;
+ });
+ });
+
+ context('when end date is before start date', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData } = getData({
+ endDate: '1989-09-XX',
+ spy,
+ });
+
+ it('should set error message ', () => {
+ validateGulfWarDates(errors, fieldData);
+ expect(spy.called).to.be.true;
+ });
+ });
+});
+
+describe('hca `validateExposureDates` form validation', () => {
+ const getData = ({
+ spy = () => {},
+ startDate = '1990-09-XX',
+ endDate = '1991-01-XX',
+ }) => ({
+ errors: {
+ toxicExposureEndDate: {
+ addError: spy,
+ },
+ },
+ fieldData: {
+ toxicExposureStartDate: startDate,
+ toxicExposureEndDate: endDate,
+ },
+ });
+
+ context('when form data is valid', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData } = getData({ spy });
+
+ it('should not set error message', () => {
+ validateExposureDates(errors, fieldData);
+ expect(spy.called).to.be.false;
+ });
+ });
+
+ context('when end date is before start date', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData } = getData({
+ endDate: '1989-09-XX',
+ spy,
+ });
+
+ it('should set error message ', () => {
+ validateExposureDates(errors, fieldData);
+ expect(spy.called).to.be.true;
+ });
+ });
+});
+
+describe('hca `validateDependentDate` form validation', () => {
+ const getData = ({
+ spy = () => {},
+ fieldData = '2010-01-01',
+ birthdate = '2009-12-31',
+ }) => ({
+ errors: { addError: spy },
+ fieldData,
+ formData: { dateOfBirth: birthdate },
+ });
+
+ context('when form data is valid', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({ spy });
+
+ it('should not set error message', () => {
+ validateDependentDate(errors, fieldData, formData);
+ expect(spy.called).to.be.false;
+ });
+ });
+
+ context('when birthdate is after dependent date', () => {
+ const spy = sinon.spy();
+ const { errors, fieldData, formData } = getData({
+ birthdate: '2011-01-01',
+ spy,
+ });
+
+ it('should set error message', () => {
+ validateDependentDate(errors, fieldData, formData);
+ expect(spy.called).to.be.true;
+ });
+ });
+});
+
+describe('hca `validateCurrency` form validation', () => {
+ const getData = ({ spy = () => {} }) => ({
+ errors: { addError: spy },
+ });
+
+ context('when form data is valid', () => {
+ const spy = sinon.spy();
+ const { errors } = getData({ spy });
+
+ it('should not set error message', () => {
+ validateCurrency(errors, '234.23');
+ expect(spy.called).to.be.false;
+ });
+ });
+
+ context('when value has three decimals', () => {
+ const spy = sinon.spy();
+ const { errors } = getData({ spy });
+
+ it('should set error message', () => {
+ validateCurrency(errors, '234.234');
+ expect(spy.called).to.be.true;
+ });
+ });
+
+ context('when value has trailing whitespace', () => {
+ const spy = sinon.spy();
+ const { errors } = getData({ spy });
+
+ it('should set error message', () => {
+ validateCurrency(errors, '234234 ');
+ expect(spy.called).to.be.true;
+ });
+ });
+
+ context('when value has leading whitespace', () => {
+ const spy = sinon.spy();
+ const { errors } = getData({ spy });
+
+ it('should set error message', () => {
+ validateCurrency(errors, ' 234234');
+ expect(spy.called).to.be.true;
+ });
+ });
+
+ context('when value includes dollar sign', () => {
+ const spy = sinon.spy();
+ const { errors } = getData({ spy });
+
+ it('should not set error message', () => {
+ validateCurrency(errors, '$234,234');
+ expect(spy.called).to.be.false;
+ });
+ });
+});
diff --git a/src/applications/hca/tests/utils/validation.unit.spec.js b/src/applications/hca/tests/utils/validation.unit.spec.js
deleted file mode 100644
index 737578119d12..000000000000
--- a/src/applications/hca/tests/utils/validation.unit.spec.js
+++ /dev/null
@@ -1,143 +0,0 @@
-import { expect } from 'chai';
-import sinon from 'sinon';
-import moment from 'moment';
-
-import {
- validateServiceDates,
- validateDependentDate,
-} from '../../utils/validation';
-
-describe('hca validation', () => {
- describe('when `validateServiceDates` executes', () => {
- describe('when form data is valid', () => {
- it('should not set error message ', () => {
- const errors = {
- lastDischargeDate: {
- addError: sinon.spy(),
- },
- };
- validateServiceDates(
- errors,
- {
- lastDischargeDate: '2016-01-01',
- lastEntryDate: '2011-01-01',
- },
- {
- veteranDateOfBirth: '1980-01-01',
- },
- );
- expect(errors.lastDischargeDate.addError.callCount).to.equal(0);
- });
- });
-
- describe('when discharge date is before entry date', () => {
- it('should set error message ', () => {
- const errors = {
- lastDischargeDate: {
- addError: sinon.spy(),
- },
- };
- validateServiceDates(
- errors,
- {
- lastDischargeDate: '2010-01-01',
- lastEntryDate: '2011-01-01',
- },
- {
- veteranDateOfBirth: '1980-01-01',
- },
- );
- expect(errors.lastDischargeDate.addError.callCount).to.equal(1);
- });
- });
-
- describe('when discharge date is later than 1 year from today', () => {
- it('should set error message', () => {
- const errors = {
- lastDischargeDate: {
- addError: sinon.spy(),
- },
- };
- validateServiceDates(
- errors,
- {
- lastDischargeDate: moment()
- .add(367, 'days')
- .format('YYYY-MM-DD'),
- lastEntryDate: '2011-01-01',
- },
- {},
- );
- expect(errors.lastDischargeDate.addError.callCount).to.equal(1);
- });
- });
-
- describe('when discharge date is exactly 1 year from today', () => {
- it('should not set message ', () => {
- const errors = {
- lastDischargeDate: {
- addError: sinon.spy(),
- },
- };
- validateServiceDates(
- errors,
- {
- lastDischargeDate: moment()
- .add(1, 'year')
- .format('YYYY-MM-DD'),
- lastEntryDate: '2011-01-01',
- },
- {},
- );
- expect(errors.lastDischargeDate.addError.callCount).to.equal(0);
- });
- });
-
- describe('when entry date is less than 15 years after date of birth', () => {
- it('should set error message ', () => {
- const errors = {
- lastEntryDate: {
- addError: sinon.spy(),
- },
- };
- validateServiceDates(
- errors,
- {
- lastDischargeDate: '2010-03-01',
- lastEntryDate: '2000-01-01',
- },
- {
- veteranDateOfBirth: '1990-01-01',
- },
- );
- expect(errors.lastEntryDate.addError.callCount).to.equal(1);
- });
- });
- });
-
- describe('when `validateDependentDate` executes', () => {
- describe('when form data is valid', () => {
- it('should not set error message', () => {
- const errors = {
- addError: sinon.spy(),
- };
- validateDependentDate(errors, '2010-01-01', {
- dateOfBirth: '2009-12-31',
- });
- expect(errors.addError.callCount).to.equal(0);
- });
- });
-
- describe('when birth date is after dependent date', () => {
- it('should set error message', () => {
- const errors = {
- addError: sinon.spy(),
- };
- validateDependentDate(errors, '2010-01-01', {
- dateOfBirth: '2011-01-01',
- });
- expect(errors.addError.callCount).to.equal(1);
- });
- });
- });
-});
diff --git a/src/applications/hca/utils/helpers/form-config.js b/src/applications/hca/utils/helpers/form-config.js
new file mode 100644
index 000000000000..cab4ca4495b3
--- /dev/null
+++ b/src/applications/hca/utils/helpers/form-config.js
@@ -0,0 +1,251 @@
+import { DEPENDENT_VIEW_FIELDS, HIGH_DISABILITY_MINIMUM } from '../constants';
+
+/**
+ * Helper that determines if user is unauthenticated
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the viewfield is truthy
+ */
+export function isLoggedOut(formData) {
+ const { 'view:isLoggedIn': isLoggedIn } = formData;
+ return !isLoggedIn;
+}
+
+/**
+ * Helper that determines if the Veteran has a lower disability rating
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the viewfield value is less than the high-
+ * disability minimum
+ */
+export function hasLowDisabilityRating(formData) {
+ return formData['view:totalDisabilityRating'] < HIGH_DISABILITY_MINIMUM;
+}
+
+/**
+ * Helper that determines if the Veteran has high-disability compensation from VA
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if `vaCompensationType` is set to 'highDisability'
+ */
+export function hasHighCompensation(formData) {
+ const { vaCompensationType } = formData;
+ return vaCompensationType === 'highDisability';
+}
+
+/**
+ * Helper that determines if the Veteran has no compensation from VA
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if `vaCompensationType` is set to 'none'
+ */
+export function hasNoCompensation(formData) {
+ const { vaCompensationType } = formData;
+ return vaCompensationType === 'none';
+}
+
+/**
+ * Helper that determines if the user is short form eligible
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the total disability rating is less than the
+ * minimum percetage and the user does not self-declares they receive
+ * compensation equal to that of a high-disability-rated Veteran
+ */
+export function notShortFormEligible(formData) {
+ return hasLowDisabilityRating(formData) && !hasHighCompensation(formData);
+}
+
+/**
+ * Helper that determines if the form data contains values that require users
+ * to upload their military discharge papers
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user was not found in the MPI database
+ */
+export function dischargePapersRequired(formData) {
+ const { 'view:isUserInMvi': isUserInMvi } = formData;
+ return notShortFormEligible(formData) && !isUserInMvi;
+}
+
+/**
+ * Helper that determines if the form data contains values that indicate an
+ * authenticated user is missing date of birth information from their profile
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user is logged in and viewfield is empty
+ */
+export function isMissingVeteranDob(formData) {
+ const { 'view:userDob': userDob } = formData;
+ return !isLoggedOut(formData) && !userDob;
+}
+
+/**
+ * Helper that determines if the form data is missing the Veteran's birth sex
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the viewfield is empty
+ */
+export function isSigiEnabled(formData) {
+ return formData['view:isSigiEnabled'];
+}
+
+/**
+ * Helper that determines if the Veteran's home and mailing address are the same
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the viewfield is set to `false`
+ */
+export function hasDifferentHomeAddress(formData) {
+ return !formData['view:doesMailingMatchHomeAddress'];
+}
+
+/**
+ * Helper that determines if the form data contains values that enable the
+ * toxic exposure questions in the Military Service chapter
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user is not short form eligible and the
+ * TERA feature flag is set to true
+ */
+export function teraInformationEnabled(formData) {
+ const { 'view:isTeraEnabled': isTeraEnabled } = formData;
+ return notShortFormEligible(formData) && isTeraEnabled;
+}
+
+/**
+ * Helper that determines if the form data contains values that indicate the
+ * user wants to fill out information related to toxic exposure
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the toxic exposure quesions are enabled and
+ * the user indicated they wanted to fill out questions related to exposure
+ */
+export function includeTeraInformation(formData) {
+ const { hasTeraResponse } = formData;
+ return teraInformationEnabled(formData) && hasTeraResponse;
+}
+
+/**
+ * Helper that determines if the form data contains values that indicate the
+ * user served in specific gulf war locations
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user indicated they served in the specified
+ * Gulf War locations
+ */
+export function includeGulfWarServiceDates(formData) {
+ const { gulfWarService } = formData;
+ return gulfWarService;
+}
+
+/**
+ * Helper that determines if the form data contains values that indicate the
+ * user has a specified other toxic exposure
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user indicated they have a specified
+ * toxic exposure
+ */
+export function includeOtherExposureDates(formData) {
+ const { 'view:otherToxicExposures': otherToxicExposures = {} } = formData;
+ const exposures = Object.values(otherToxicExposures);
+ return exposures.some(o => o);
+}
+
+/**
+ * Helper that determines if the form data contains values that indicate the
+ * user has a specified other toxic exposure
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user indicated they had a toxic exposure
+ * that was not on the specified list
+ */
+export function includeOtherExposureDetails(formData) {
+ return formData['view:otherToxicExposures']?.exposureToOther;
+}
+
+/**
+ * Helper that determines if financial confirmation alert is to be shown
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user indicated they did not want to
+ * disclose their financials
+ */
+export function showFinancialConfirmation(formData) {
+ const { discloseFinancialInformation } = formData;
+ return notShortFormEligible(formData) && !discloseFinancialInformation;
+}
+
+/**
+ * Helper that determines if financial information is being collected
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user indicated they wanted to disclose
+ * their financials
+ */
+export function includeHouseholdInformation(formData) {
+ const { discloseFinancialInformation } = formData;
+ return notShortFormEligible(formData) && discloseFinancialInformation;
+}
+
+/**
+ * Helper that determines if the form data contains values that require users
+ * to fill out spousal information
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if the user declares they would like to provide their
+ * financial data & have a marital status of 'married' or 'separated'
+ */
+export function includeSpousalInformation(formData) {
+ const { maritalStatus } = formData;
+ const hasSpouseToDeclare =
+ maritalStatus?.toLowerCase() === 'married' ||
+ maritalStatus?.toLowerCase() === 'separated';
+ return includeHouseholdInformation(formData) && hasSpouseToDeclare;
+}
+
+/**
+ * Helper that determines if the Veteran & their spouse cohabitated last year
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if cohabitedLastYear is set to `false` and spousal
+ * information should be included in the form
+ */
+export function spouseDidNotCohabitateWithVeteran(formData) {
+ const { cohabitedLastYear } = formData;
+ return includeSpousalInformation(formData) && !cohabitedLastYear;
+}
+
+/**
+ * Helper that determines if the Veteran's spouse has the same address
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if sameAddress is set to `false` and spousal
+ * information should be included in the form
+ */
+export function spouseAddressDoesNotMatchVeterans(formData) {
+ const { sameAddress } = formData;
+ return includeSpousalInformation(formData) && !sameAddress;
+}
+
+/**
+ * Helper that determines if dependent information needs to be collected
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if viewfield is set to `false`
+ */
+export function includeDependentInformation(formData) {
+ return (
+ includeHouseholdInformation(formData) &&
+ !formData[DEPENDENT_VIEW_FIELDS.skip]
+ );
+}
+
+/**
+ * Helper that determines if insurance policy information needs to be collected
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if viewfield is set to `false`
+ */
+export function collectMedicareInformation(formData) {
+ const { isEnrolledMedicarePartA } = formData;
+ return notShortFormEligible(formData) && isEnrolledMedicarePartA;
+}
+
+/**
+ * Helper that determines if we should display the Lighthouse facility list
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if viewfield is set to `true`
+ */
+export function useLighthouseFacilityList(formData) {
+ return formData['view:isFacilitiesApiEnabled'];
+}
+
+/**
+ * Helper that determines if we should display the hardcoded facility list
+ * @param {Object} formData - the current data object passed from the form
+ * @returns {Boolean} - true if viewfield is set to `false`
+ */
+export function useJsonFacilityList(formData) {
+ return !useLighthouseFacilityList(formData);
+}
diff --git a/src/applications/hca/utils/helpers.js b/src/applications/hca/utils/helpers/index.js
similarity index 90%
rename from src/applications/hca/utils/helpers.js
rename to src/applications/hca/utils/helpers/index.js
index e5019e3fc901..8ed97c91daca 100644
--- a/src/applications/hca/utils/helpers.js
+++ b/src/applications/hca/utils/helpers/index.js
@@ -15,7 +15,7 @@ import {
import { getInactivePages } from 'platform/forms/helpers';
import { isInMPI } from 'platform/user/selectors';
-import { HIGH_DISABILITY_MINIMUM } from './constants';
+import { HIGH_DISABILITY_MINIMUM } from '../constants';
// clean address so we only get address related properties then return the object
const cleanAddressObject = address => {
@@ -269,39 +269,6 @@ export function createLiteralMap(arrayToMap) {
}, {});
}
-/**
- * Helper that determines if the form data contains values that allow users
- * to fill out the form using the short form flow
- * @param {Object} formData - the current data object passed from the form
- * @returns {Boolean} - true if the total disability rating is greater than or equal
- * to the minimum percetage OR the user self-declares they receive compensation equal to
- * that of a high-disability-rated Veteran.
- */
-export function isShortFormEligible(formData) {
- const {
- 'view:totalDisabilityRating': disabilityRating,
- vaCompensationType,
- } = formData;
- const hasHighRating = disabilityRating >= HIGH_DISABILITY_MINIMUM;
- const hasHighCompensation = vaCompensationType === 'highDisability';
- return hasHighRating || hasHighCompensation;
-}
-
-/**
- * Helper that determines if the form data contains values that require users
- * to fill out spousal information
- * @param {Object} formData - the current data object passed from the form
- * @returns {Boolean} - true if the user declares they would like to provide their
- * financial data & have a marital status of 'married' or 'separated'.
- */
-export function includeSpousalInformation(formData) {
- const { discloseFinancialInformation, maritalStatus } = formData;
- const hasSpouseToDeclare =
- maritalStatus?.toLowerCase() === 'married' ||
- maritalStatus?.toLowerCase() === 'separated';
- return discloseFinancialInformation && hasSpouseToDeclare;
-}
-
/**
* Helper that returns a descriptive aria label for the edit buttons on the
* health insurance information page
diff --git a/src/applications/hca/utils/selectors/feature-toggles.js b/src/applications/hca/utils/selectors/feature-toggles.js
index cc40a29b67b5..de4f78120dc7 100644
--- a/src/applications/hca/utils/selectors/feature-toggles.js
+++ b/src/applications/hca/utils/selectors/feature-toggles.js
@@ -11,5 +11,6 @@ export const selectFeatureToggles = state => {
toggles[FEATURE_FLAG_NAMES.hcaEnrollmentStatusOverrideEnabled],
isFacilitiesApiEnabled: toggles[FEATURE_FLAG_NAMES.hcaUseFacilitiesApi],
isSigiEnabled: toggles[FEATURE_FLAG_NAMES.hcaSigiEnabled],
+ isTeraEnabled: toggles[FEATURE_FLAG_NAMES.hcaTeraEnabled],
};
};
diff --git a/src/applications/hca/utils/validation.js b/src/applications/hca/utils/validation.js
index ecddaa9996c2..64128897c34a 100644
--- a/src/applications/hca/utils/validation.js
+++ b/src/applications/hca/utils/validation.js
@@ -1,5 +1,4 @@
import moment from 'moment';
-
import {
convertToDateField,
validateCurrentOrPastDate,
@@ -38,6 +37,35 @@ export function validateServiceDates(
}
}
}
+
+export function validateGulfWarDates(
+ errors,
+ { gulfWarStartDate, gulfWarEndDate },
+) {
+ const fromDate = convertToDateField(gulfWarStartDate);
+ const toDate = convertToDateField(gulfWarEndDate);
+
+ if (!isValidDateRange(fromDate, toDate)) {
+ errors.gulfWarEndDate.addError(
+ 'Service end date must be after the service start date',
+ );
+ }
+}
+
+export function validateExposureDates(
+ errors,
+ { toxicExposureStartDate, toxicExposureEndDate },
+) {
+ const fromDate = convertToDateField(toxicExposureStartDate);
+ const toDate = convertToDateField(toxicExposureEndDate);
+
+ if (!isValidDateRange(fromDate, toDate)) {
+ errors.toxicExposureEndDate.addError(
+ 'Exposure end date must be after the exposure start date',
+ );
+ }
+}
+
export function validateDependentDate(errors, fieldData, { dateOfBirth }) {
const dependentDate = moment(fieldData);
const birthDate = moment(dateOfBirth);
diff --git a/src/applications/ivc-champva/10-10D/config/form.js b/src/applications/ivc-champva/10-10D/config/form.js
index 3af9bd40abb9..ea642e5dbece 100644
--- a/src/applications/ivc-champva/10-10D/config/form.js
+++ b/src/applications/ivc-champva/10-10D/config/form.js
@@ -615,6 +615,7 @@ const formConfig = {
title: item => `${applicantWording(item)} mailing address`,
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
'view:description': {
'ui:description':
@@ -656,6 +657,7 @@ const formConfig = {
title: item => `${applicantWording(item)} contact information`,
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
'ui:options': {
updateSchema: formData => {
@@ -688,6 +690,7 @@ const formConfig = {
uiSchema: {
'ui:title': 'Applicant Gender',
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
'ui:options': {
updateSchema: formData => {
@@ -745,6 +748,7 @@ const formConfig = {
)?.relationshipToVeteran === 'child',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -792,6 +796,7 @@ const formConfig = {
),
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -829,6 +834,7 @@ const formConfig = {
)?.relationshipToVeteran === 'child',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
({ formData }) =>
@@ -873,6 +879,7 @@ const formConfig = {
) === 'adoption',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -915,6 +922,7 @@ const formConfig = {
) === 'step',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -954,6 +962,7 @@ const formConfig = {
)?.relationshipToVeteran === 'spouse',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -1035,6 +1044,7 @@ const formConfig = {
),
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -1078,6 +1088,7 @@ const formConfig = {
)?.includes('partD'),
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -1129,6 +1140,7 @@ const formConfig = {
'yes',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
@@ -1168,6 +1180,7 @@ const formConfig = {
) === 'enrolled',
uiSchema: {
applicants: {
+ 'ui:options': { viewField: ApplicantField },
items: {
...titleUI(
'Required supporting file upload',
diff --git a/src/applications/ivc-champva/10-10D/config/submitTransformer.js b/src/applications/ivc-champva/10-10D/config/submitTransformer.js
index d54b1553a1ba..f3e674926ba0 100644
--- a/src/applications/ivc-champva/10-10D/config/submitTransformer.js
+++ b/src/applications/ivc-champva/10-10D/config/submitTransformer.js
@@ -34,19 +34,15 @@ function transformApplicants(applicants) {
app?.applicantMedicareCardBack,
app?.applicantOHICardFront,
app?.applicantOHICardBack,
- app?.applicantMedicarePartAPartBCard,
- app?.applicantMedicarePartDCard,
- app?.applicantOhiCard,
- app?.applicant107959c,
app?.applicantBirthCertOrSocialSecCard,
- app?.applicantMedicarePartAPartBCard,
- app?.applicantMedicarePartDCard,
- app?.applicantOhiCard,
- app?.applicant107959c,
app?.applicantSchoolCert,
app?.applicantAdoptionPapers,
app?.applicantStepMarriageCert,
app?.applicantMarriageCert,
+ app?.applicantMedicarePartAPartBCard,
+ app?.applicantMedicarePartDCard,
+ app?.applicantOhiCard,
+ app?.applicant107959c,
],
address: app.applicantAddress ?? '',
gender: app.applicantGender ?? '',
@@ -119,6 +115,7 @@ export default function transformForSubmit(formConfig, form) {
});
dataPostTransform.supporting_docs = dataPostTransform.supporting_docs
+ .flat()
.concat(supDocs)
.filter(el => el); // remove undefineds
diff --git a/src/applications/ivc-champva/10-10D/tests/components/CustomCheckboxRadioReviewPage.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/components/CustomCheckboxRadioReviewPage.unit.spec.js
new file mode 100644
index 000000000000..b889771ac57d
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/components/CustomCheckboxRadioReviewPage.unit.spec.js
@@ -0,0 +1,15 @@
+import React from 'react';
+import { CustomCheckboxRadioReviewPage } from '../../components/CustomCheckboxRadioReviewPage';
+import { testComponentRender } from '../../../shared/tests/pages/pageTests.spec';
+import mockData from '../fixtures/data/test-data.json';
+import { generateOptions } from '../../pages/ApplicantMedicareStatusPage';
+
+testComponentRender(
+ 'CustomCheckboxRadioReviewPage',
+ {}}
+ generateOptions={generateOptions}
+ />,
+);
diff --git a/src/applications/ivc-champva/10-10D/tests/components/CustomRelationshipPattern.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/components/CustomRelationshipPattern.unit.spec.js
new file mode 100644
index 000000000000..15749a3ac6bb
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/components/CustomRelationshipPattern.unit.spec.js
@@ -0,0 +1,23 @@
+import { expect } from 'chai';
+import { relationshipToVeteranUI } from '../../components/CustomRelationshipPattern';
+
+describe('Custom relationship pattern', () => {
+ it('should default to veteran', () => {
+ const relationship = relationshipToVeteranUI();
+ expect(relationship.relationshipToVeteran?.['ui:title']).to.contain(
+ 'Veteran',
+ );
+ });
+ it('should use functions for titles', () => {
+ const relationship = relationshipToVeteranUI({
+ relativeTitle: () => '',
+ });
+ expect(relationship.relationshipToVeteran['ui:title']).to.exist;
+ });
+ it('should allow past-tense wording', () => {
+ const relationship = relationshipToVeteranUI({ tense: 'past' });
+ expect(relationship.relationshipToVeteran?.['ui:title']).to.contain(
+ 'What’s your relationship',
+ );
+ });
+});
diff --git a/src/applications/ivc-champva/10-10D/tests/components/sponsorFileUploads.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/components/sponsorFileUploads.unit.spec.js
new file mode 100644
index 000000000000..e9d2eb58498b
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/components/sponsorFileUploads.unit.spec.js
@@ -0,0 +1,11 @@
+import { expect } from 'chai';
+import { uploadWithInfoComponent } from '../../components/Sponsor/sponsorFileUploads';
+
+describe('uploadWithInfoComponent', () => {
+ it('should accept resource links', async () => {
+ const upload = uploadWithInfoComponent(undefined, '', false, [
+ { href: 'www.test.gov', text: 'Test' },
+ ]);
+ expect(upload.uiSchema).to.exist;
+ });
+});
diff --git a/src/applications/ivc-champva/10-10D/tests/config/form.unit.spec.jsx b/src/applications/ivc-champva/10-10D/tests/config/form.unit.spec.jsx
index 1fb7d81ec0b7..206d30ebdf61 100644
--- a/src/applications/ivc-champva/10-10D/tests/config/form.unit.spec.jsx
+++ b/src/applications/ivc-champva/10-10D/tests/config/form.unit.spec.jsx
@@ -1,4 +1,4 @@
-// import sinon from 'sinon';
+import sinon from 'sinon';
import { expect } from 'chai';
import React from 'react';
import {
@@ -12,16 +12,23 @@ import {
testComponentRender,
getProps,
} from '../../../shared/tests/pages/pageTests.spec';
+import ApplicantMedicareStatusContinuedPage, {
+ ApplicantMedicareStatusContinuedReviewPage,
+} from '../../pages/ApplicantMedicareStatusContinuedPage';
+import ApplicantOhiStatusPage from '../../pages/ApplicantOhiStatusPage';
+import ApplicantRelationshipPage from '../../pages/ApplicantRelationshipPage';
import formConfig from '../../config/form';
import { getFileSize } from '../../helpers/utilities';
import FileFieldCustom from '../../components/File/FileUpload';
import FileViewField from '../../components/File/FileViewField';
+import mockData from '../fixtures/data/test-data.json';
+
const applicants = [
{
applicantSSN: '111221234',
- applicantDOB: '2000-01-03',
+ applicantDOB: '2007-01-03',
applicantName: {
first: 'Jerry',
middle: 'J',
@@ -32,6 +39,42 @@ const applicants = [
},
];
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.sponsorInformation.pages.page6.schema,
+ formConfig.chapters.sponsorInformation.pages.page6.uiSchema,
+ 5,
+ 'Sponsor - name and date of birth',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.sponsorInformation.pages.page7.schema,
+ formConfig.chapters.sponsorInformation.pages.page7.uiSchema,
+ 2,
+ 'Sponsor - identification information',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.sponsorInformation.pages.page9a.schema,
+ formConfig.chapters.sponsorInformation.pages.page9a.uiSchema,
+ 0,
+ 'Sponsor - casualty report',
+ { ...mockData.data, sponsorIsDeceased: true, sponsorDeathConditions: true },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.sponsorInformation.pages.page10b1.schema,
+ formConfig.chapters.sponsorInformation.pages.page10b1.uiSchema,
+ 8,
+ 'Sponsor - mailing address',
+ { ...mockData.data },
+);
+
testNumberOfWebComponentFields(
formConfig,
formConfig.chapters.sponsorInformation.pages.page11.schema,
@@ -41,6 +84,24 @@ testNumberOfWebComponentFields(
{ sponsorIsDeceased: false },
);
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.sponsorInformation.pages.page12.schema,
+ formConfig.chapters.sponsorInformation.pages.page12.uiSchema,
+ 0,
+ 'Sponsor - disability rating',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.sponsorInformation.pages.page12a.schema,
+ formConfig.chapters.sponsorInformation.pages.page12a.uiSchema,
+ 0,
+ 'Sponsor - discharge papers',
+ { ...mockData.data },
+);
+
testNumberOfWebComponentFields(
formConfig,
formConfig.chapters.applicantInformation.pages.page14.schema,
@@ -50,6 +111,123 @@ testNumberOfWebComponentFields(
{ applicants },
);
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page15.schema,
+ formConfig.chapters.applicantInformation.pages.page15.uiSchema,
+ 8,
+ 'Applicant - mailing address',
+ { applicants },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page16.schema,
+ formConfig.chapters.applicantInformation.pages.page16.uiSchema,
+ 2,
+ 'Applicant - contact information',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page17.schema,
+ formConfig.chapters.applicantInformation.pages.page17.uiSchema,
+ 1,
+ 'Applicant - gender',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page18a.schema,
+ formConfig.chapters.applicantInformation.pages.page18a.uiSchema,
+ 0,
+ 'Applicant - birth certificate',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page18b.schema,
+ formConfig.chapters.applicantInformation.pages.page18b.uiSchema,
+ 0,
+ 'Applicant - school certificate',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page18c.schema,
+ formConfig.chapters.applicantInformation.pages.page18c.uiSchema,
+ 1,
+ 'Applicant - relationship to sponsor',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page18d.schema,
+ formConfig.chapters.applicantInformation.pages.page18d.uiSchema,
+ 0,
+ 'Applicant - adoption documents',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page18e.schema,
+ formConfig.chapters.applicantInformation.pages.page18e.uiSchema,
+ 0,
+ 'Applicant - step marriage certificate',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page18f.schema,
+ formConfig.chapters.applicantInformation.pages.page18f.uiSchema,
+ 0,
+ 'Applicant - marriage documents',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page20a.schema,
+ formConfig.chapters.applicantInformation.pages.page20a.uiSchema,
+ 0,
+ 'Applicant - medicare parts A/B upload',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page20b.schema,
+ formConfig.chapters.applicantInformation.pages.page20b.uiSchema,
+ 0,
+ 'Applicant - medicare part D upload',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page21a.schema,
+ formConfig.chapters.applicantInformation.pages.page21a.uiSchema,
+ 0,
+ 'Applicant - ohi upload',
+ { ...mockData.data },
+);
+
+testNumberOfWebComponentFields(
+ formConfig,
+ formConfig.chapters.applicantInformation.pages.page22.schema,
+ formConfig.chapters.applicantInformation.pages.page22.uiSchema,
+ 0,
+ 'Applicant - 10-7959c upload',
+ { ...mockData.data },
+);
+
/*
// Commented out because this page doesn't exist currently (but may in future)
testNumberOfWebComponentFields(
@@ -62,6 +240,26 @@ testNumberOfWebComponentFields(
);
*/
+testComponentRender(
+ 'ApplicantMedicareStatusContinuedPage',
+ ,
+);
+
+testComponentRender(
+ 'ApplicantMedicareStatusContinuedReviewPage ',
+ <>{ApplicantMedicareStatusContinuedReviewPage()}>,
+);
+
+testComponentRender(
+ 'ApplicantOhiStatusPage',
+ ,
+);
+
+testComponentRender(
+ 'ApplicantRelationshipPage ',
+ ,
+);
+
testComponentRender('FileFieldCustom', );
testComponentRender(
'FileViewField',
@@ -91,6 +289,27 @@ describe('FileFieldCustom remove button', () => {
});
});
+describe('FileFieldCustom continue button', () => {
+ it('should call goForward', async () => {
+ const goFwdSpy = sinon.spy();
+ const component = (
+ {}}
+ />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(goFwdSpy.called).to.be.true;
+ });
+ });
+});
+
describe('File sizes', () => {
it('should be in bytes for values < 999', () => {
expect(getFileSize(998)).to.equal('998 B');
diff --git a/src/applications/ivc-champva/10-10D/tests/fixtures/data/test-data.json b/src/applications/ivc-champva/10-10D/tests/fixtures/data/test-data.json
index 30c7e17fb1b9..0bb6f576dc88 100644
--- a/src/applications/ivc-champva/10-10D/tests/fixtures/data/test-data.json
+++ b/src/applications/ivc-champva/10-10D/tests/fixtures/data/test-data.json
@@ -1,4 +1,57 @@
{
"data": {
+ "certifierRole": "sponsor",
+ "applicants": [
+ {
+ "applicantRelationshipOrigin": "blood",
+ "applicantGender": "male",
+ "applicantEmailAddress": "johnny@alvin.gov",
+ "applicantAddress": {
+ "country": "USA",
+ "street": "456 Circle Street",
+ "city": "Clinton",
+ "state": "AS",
+ "postalCode": "56790"
+ },
+ "applicantSSN": {
+ "ssn": "345345345"
+ },
+ "applicantRelationshipToSponsor": {
+ "relationshipToVeteran": "child"
+ },
+ "applicantEnrolledInMedicare": false,
+ "applicantEnrolledInOHI": false,
+ "applicantDOB": "2000-01-04",
+ "applicantName": {
+ "first": "Johnny",
+ "middle": "T",
+ "last": "Alvin",
+ "suffix": "Jr."
+ },
+ "applicantMedicareStatus": "enrolled",
+ "applicantMedicarePart": "partA, partD",
+ "applicantHasOhi": "yes"
+ }
+ ],
+ "sponsorPhone": "5555555555",
+ "sponsorHasPhone": "yes",
+ "sponsorAddress": {
+ "country": "USA",
+ "street": "123 Anystreet",
+ "city": "Anyville",
+ "state": "AL",
+ "postalCode": "12345"
+ },
+ "sponsorHasAddress": "yes",
+ "ssn": {
+ "ssn": "123123123"
+ },
+ "veteransFullName": {
+ "first": "Joe",
+ "last": "Johnson"
+ },
+ "sponsorDOB": "1958-01-01",
+ "statementOfTruthSignature": "Joe Johnson",
+ "statementOfTruthCertified": true
}
}
diff --git a/src/applications/ivc-champva/10-10D/tests/helpers/helpers.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/helpers/helpers.unit.spec.js
index 7d721b801f25..fc7c43e637bf 100644
--- a/src/applications/ivc-champva/10-10D/tests/helpers/helpers.unit.spec.js
+++ b/src/applications/ivc-champva/10-10D/tests/helpers/helpers.unit.spec.js
@@ -1,5 +1,10 @@
import { expect } from 'chai';
+import React from 'react';
import { applicantWording } from '../../helpers/wordingCustomization';
+import { getAgeInYears, isInRange, getParts } from '../../helpers/utilities';
+import ApplicantField from '../../components/Applicant/ApplicantField';
+import { testComponentRender } from '../../../shared/tests/pages/pageTests.spec';
+import mockData from '../fixtures/data/test-data.json';
describe('applicantWording helper', () => {
it('should concatenate first and last names', () => {
@@ -10,3 +15,36 @@ describe('applicantWording helper', () => {
).to.equal("firstname lastname's ");
});
});
+
+describe('getAgeInYears helper', () => {
+ const year = Number(
+ new Date()
+ .getFullYear()
+ .toString()
+ .slice(-2),
+ );
+
+ it('should return the proper age in years', () => {
+ expect(getAgeInYears('2000-01-01')).to.equal(year);
+ });
+});
+
+describe('isInRange helper', () => {
+ it('should return true if number in range', () => {
+ expect(isInRange(22, 18, 23)).to.be.true;
+ });
+ it('should return false if number not in range', () => {
+ expect(isInRange(25, 18, 23)).to.be.false;
+ });
+});
+
+describe('getParts helper', () => {
+ it('should clean up presentation of medicare part text', () => {
+ expect(getParts('partA, partB, partD')).to.equal('Part A, Part B');
+ });
+});
+
+testComponentRender(
+ 'ApplicantField',
+ ,
+);
diff --git a/src/applications/ivc-champva/10-10D/tests/pages/applicantMedicareStatusContinuedPage.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/pages/applicantMedicareStatusContinuedPage.unit.spec.js
new file mode 100644
index 000000000000..a3fb0ca7ecfe
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/pages/applicantMedicareStatusContinuedPage.unit.spec.js
@@ -0,0 +1,75 @@
+import sinon from 'sinon';
+import { expect } from 'chai';
+import React from 'react';
+import { render, fireEvent, waitFor } from '@testing-library/react';
+import { Provider } from 'react-redux';
+import { $ } from '@department-of-veterans-affairs/platform-forms-system/ui';
+import {
+ testComponentRender,
+ getProps,
+} from '../../../shared/tests/pages/pageTests.spec';
+import ApplicantMedicareStatusContinuedPage, {
+ ApplicantMedicareStatusContinuedReviewPage,
+} from '../../pages/ApplicantMedicareStatusContinuedPage';
+import mockData from '../fixtures/data/test-data.json';
+
+testComponentRender(
+ 'ApplicantMedicareStatusReviewPage',
+ <>{ApplicantMedicareStatusContinuedReviewPage()}>,
+);
+
+testComponentRender(
+ 'ApplicantMedicareStatusPage',
+ ,
+);
+
+// Causes 'useFirstPerson' to be true:
+testComponentRender(
+ 'ApplicantMedicareStatusPage',
+ ,
+);
+
+describe('ApplicantMedicareStatusContinuedPage handlers', () => {
+ it('should call goForward when "continue" clicked', async () => {
+ const goFwdSpy = sinon.spy();
+ const component = (
+ {}}
+ />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(goFwdSpy.called).to.be.true;
+ });
+ });
+});
+
+describe('ApplicantMedicareStatusContinuedPage', () => {
+ it('should show err msg when no option selected', async () => {
+ const component = (
+ mockData.data} />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const group = $('va-checkbox-group', view.container);
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(group.error).to.not.equal(null);
+ });
+ });
+});
diff --git a/src/applications/ivc-champva/10-10D/tests/pages/applicantMedicareStatusPage.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/pages/applicantMedicareStatusPage.unit.spec.js
new file mode 100644
index 000000000000..a06206a52e80
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/pages/applicantMedicareStatusPage.unit.spec.js
@@ -0,0 +1,75 @@
+import sinon from 'sinon';
+import { expect } from 'chai';
+import React from 'react';
+import { render, fireEvent, waitFor } from '@testing-library/react';
+import { Provider } from 'react-redux';
+import { $ } from '@department-of-veterans-affairs/platform-forms-system/ui';
+import {
+ testComponentRender,
+ getProps,
+} from '../../../shared/tests/pages/pageTests.spec';
+import {
+ ApplicantMedicareStatusPage,
+ ApplicantMedicareStatusReviewPage,
+} from '../../pages/ApplicantMedicareStatusPage';
+import mockData from '../fixtures/data/test-data.json';
+
+testComponentRender(
+ 'ApplicantMedicareStatusReviewPage',
+ <>{ApplicantMedicareStatusReviewPage()}>,
+);
+
+testComponentRender(
+ 'ApplicantMedicareStatusPage',
+ ,
+);
+
+// Causes 'useFirstPerson' to be true:
+testComponentRender(
+ 'ApplicantMedicareStatusPage',
+ ,
+);
+
+describe('ApplicantMedicareStatusPage handlers', () => {
+ it('should call goForward when "continue" clicked', async () => {
+ const goFwdSpy = sinon.spy();
+ const component = (
+ {}}
+ />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(goFwdSpy.called).to.be.true;
+ });
+ });
+});
+
+describe('ApplicantMedicareStatusPage', () => {
+ it('should show err msg when no option selected', async () => {
+ const component = (
+ mockData.data} />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect($('va-radio', view.container).error).to.not.equal(null);
+ });
+ });
+});
diff --git a/src/applications/ivc-champva/10-10D/tests/pages/applicantOhiStatusPage.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/pages/applicantOhiStatusPage.unit.spec.js
new file mode 100644
index 000000000000..ffd241c4a572
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/pages/applicantOhiStatusPage.unit.spec.js
@@ -0,0 +1,73 @@
+import sinon from 'sinon';
+import { expect } from 'chai';
+import React from 'react';
+import { render, fireEvent, waitFor } from '@testing-library/react';
+import { Provider } from 'react-redux';
+import { $ } from '@department-of-veterans-affairs/platform-forms-system/ui';
+import {
+ testComponentRender,
+ getProps,
+} from '../../../shared/tests/pages/pageTests.spec';
+import ApplicantOhiStatusPage, {
+ ApplicantOhiStatusReviewPage,
+} from '../../pages/ApplicantOhiStatusPage';
+import mockData from '../fixtures/data/test-data.json';
+
+testComponentRender(
+ 'ApplicantOhiStatusReviewPage',
+ <>{ApplicantOhiStatusReviewPage()}>,
+);
+
+testComponentRender(
+ 'ApplicantOhiStatusPage',
+ ,
+);
+
+// Causes 'useFirstPerson' to be true:
+testComponentRender(
+ 'ApplicantOhiStatusPage',
+ ,
+);
+
+describe('ApplicantOhiStatusPage handlers', () => {
+ it('should call goForward when "continue" clicked', async () => {
+ const goFwdSpy = sinon.spy();
+ const component = (
+ {}}
+ />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(goFwdSpy.called).to.be.true;
+ });
+ });
+});
+
+describe('ApplicantOhiStatusPage', () => {
+ it('should show err msg when no option selected', async () => {
+ const component = {}} />;
+ const { mockStore } = getProps();
+ const view = render({component});
+ const group = $('va-radio', view.container);
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(group.error).to.not.equal(null);
+ });
+ });
+});
diff --git a/src/applications/ivc-champva/10-10D/tests/pages/applicantRelationshipPage.unit.spec.js b/src/applications/ivc-champva/10-10D/tests/pages/applicantRelationshipPage.unit.spec.js
new file mode 100644
index 000000000000..21324cb1f937
--- /dev/null
+++ b/src/applications/ivc-champva/10-10D/tests/pages/applicantRelationshipPage.unit.spec.js
@@ -0,0 +1,73 @@
+import sinon from 'sinon';
+import { expect } from 'chai';
+import React from 'react';
+import { render, fireEvent, waitFor } from '@testing-library/react';
+import { Provider } from 'react-redux';
+import { $ } from '@department-of-veterans-affairs/platform-forms-system/ui';
+import {
+ testComponentRender,
+ getProps,
+} from '../../../shared/tests/pages/pageTests.spec';
+import ApplicantRelationshipPage, {
+ ApplicantRelationshipReviewPage,
+} from '../../pages/ApplicantRelationshipPage';
+import mockData from '../fixtures/data/test-data.json';
+
+testComponentRender(
+ 'ApplicantRelationshipReviewPage',
+ <>{ApplicantRelationshipReviewPage({ data: '' })}>,
+);
+
+// Causes 'useFirstPerson' to be true:
+testComponentRender(
+ 'ApplicantRelationshipPage',
+ ,
+);
+
+describe('ApplicantRelationshipPage handlers', () => {
+ it('should call goForward when "continue" clicked', async () => {
+ const goFwdSpy = sinon.spy();
+ const component = (
+ {}}
+ />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(goFwdSpy.called).to.be.true;
+ });
+ });
+});
+
+describe('ApplicantRelationshipPage', () => {
+ it('should show err msg when no option selected', async () => {
+ const component = (
+ {}}
+ />
+ );
+ const { mockStore } = getProps();
+ const view = render({component});
+ const group = $('va-radio', view.container);
+ const continueButton = $('.usa-button-primary', view.container);
+ expect(continueButton).to.contain.text('Continue');
+ fireEvent.click(continueButton);
+ await waitFor(() => {
+ expect(group.error).to.not.equal(null);
+ });
+ });
+});
diff --git a/src/applications/ivc-champva/10-7959f-1/config/form.js b/src/applications/ivc-champva/10-7959f-1/config/form.js
index c459c2e03faf..3dec2efc974b 100644
--- a/src/applications/ivc-champva/10-7959f-1/config/form.js
+++ b/src/applications/ivc-champva/10-7959f-1/config/form.js
@@ -9,6 +9,7 @@ import {
fullNameSchema,
phoneUI,
phoneSchema,
+ titleUI,
} from 'platform/forms-system/src/js/web-component-patterns';
import * as address from 'platform/forms-system/src/js/definitions/address';
@@ -79,17 +80,20 @@ const formConfig = {
},
},
page2: {
- path: 'sponsor-information/ssn',
- title: 'Sponsor SSN and VA file number',
+ path: 'veteran-information/ssn',
+ title: 'Veteran SSN and VA file number',
uiSchema: {
- sponsorInfoTitle: inlineTitleUI('Sponsor SSN or VA file number'),
+ ...titleUI(
+ `Veteran's identification information`,
+ `You must enter either a Social Security number of VA File number`,
+ ),
ssn: ssnOrVaFileNumberUI(),
},
schema: {
type: 'object',
required: ['ssn'],
properties: {
- sponsorInfoTitle: titleSchema,
+ titleSchema,
ssn: ssnOrVaFileNumberSchema,
},
},
diff --git a/src/applications/mhv/medical-records/actions/alerts.js b/src/applications/mhv/medical-records/actions/alerts.js
index f3d24ba55ae2..1f583e2b0855 100644
--- a/src/applications/mhv/medical-records/actions/alerts.js
+++ b/src/applications/mhv/medical-records/actions/alerts.js
@@ -1,10 +1,17 @@
import { Actions } from '../util/actionTypes';
-export const addAlert = type => async dispatch => {
+export const addAlert = (type, error) => async dispatch => {
dispatch({
type: Actions.Alerts.ADD_ALERT,
payload: {
type,
+ error,
},
});
};
+
+export const clearAlerts = () => async dispatch => {
+ dispatch({
+ type: Actions.Alerts.CLEAR_ALERT,
+ });
+};
diff --git a/src/applications/mhv/medical-records/actions/allergies.js b/src/applications/mhv/medical-records/actions/allergies.js
index 29a79ec2fc1f..2144d6e500c2 100644
--- a/src/applications/mhv/medical-records/actions/allergies.js
+++ b/src/applications/mhv/medical-records/actions/allergies.js
@@ -17,7 +17,7 @@ export const getAllergiesList = (isCurrent = false) => async dispatch => {
isCurrent,
});
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
@@ -32,7 +32,7 @@ export const getAllergyDetails = (id, allergyList) => async dispatch => {
Actions.Allergies.GET,
);
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
diff --git a/src/applications/mhv/medical-records/actions/blueButtonReport.js b/src/applications/mhv/medical-records/actions/blueButtonReport.js
index 583dd962fe36..b244b1b30284 100644
--- a/src/applications/mhv/medical-records/actions/blueButtonReport.js
+++ b/src/applications/mhv/medical-records/actions/blueButtonReport.js
@@ -28,6 +28,6 @@ export const getBlueButtonReportData = () => async dispatch => {
});
dispatch({ type: Actions.Vitals.GET_LIST, response: response.vitals });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
diff --git a/src/applications/mhv/medical-records/actions/careSummariesAndNotes.js b/src/applications/mhv/medical-records/actions/careSummariesAndNotes.js
index 725bcc3c4cfd..c17d52299155 100644
--- a/src/applications/mhv/medical-records/actions/careSummariesAndNotes.js
+++ b/src/applications/mhv/medical-records/actions/careSummariesAndNotes.js
@@ -9,7 +9,8 @@ export const getCareSummariesAndNotesList = () => async dispatch => {
const response = await getNotes();
dispatch({ type: Actions.CareSummariesAndNotes.GET_LIST, response });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
+ throw error;
}
};
@@ -27,7 +28,8 @@ export const getCareSummaryAndNotesDetails = (
Actions.CareSummariesAndNotes.GET,
);
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
+ throw error;
}
};
diff --git a/src/applications/mhv/medical-records/actions/conditions.js b/src/applications/mhv/medical-records/actions/conditions.js
index b81420fcfaaa..a4e52c882160 100644
--- a/src/applications/mhv/medical-records/actions/conditions.js
+++ b/src/applications/mhv/medical-records/actions/conditions.js
@@ -9,7 +9,7 @@ export const getConditionsList = () => async dispatch => {
const response = await getConditions();
dispatch({ type: Actions.Conditions.GET_LIST, response });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
@@ -27,7 +27,7 @@ export const getConditionDetails = (
Actions.Conditions.GET,
);
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
diff --git a/src/applications/mhv/medical-records/actions/labsAndTests.js b/src/applications/mhv/medical-records/actions/labsAndTests.js
index 9e978306489e..9c093a31256b 100644
--- a/src/applications/mhv/medical-records/actions/labsAndTests.js
+++ b/src/applications/mhv/medical-records/actions/labsAndTests.js
@@ -8,7 +8,7 @@ export const getLabsAndTestsList = () => async dispatch => {
const response = await getLabsAndTests();
dispatch({ type: Actions.LabsAndTests.GET_LIST, response });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
@@ -17,7 +17,7 @@ export const getlabsAndTestsDetails = labId => async dispatch => {
const response = await getLabOrTest(labId);
dispatch({ type: Actions.LabsAndTests.GET, response });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
diff --git a/src/applications/mhv/medical-records/actions/vaccines.js b/src/applications/mhv/medical-records/actions/vaccines.js
index e34747f564f8..b58fe8d10ea3 100644
--- a/src/applications/mhv/medical-records/actions/vaccines.js
+++ b/src/applications/mhv/medical-records/actions/vaccines.js
@@ -10,7 +10,7 @@ export const getVaccinesList = () => async dispatch => {
dispatch({ type: Actions.Vaccines.GET_LIST, response });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
@@ -25,7 +25,7 @@ export const getVaccineDetails = (vaccineId, vaccineList) => async dispatch => {
Actions.Vaccines.GET,
);
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
diff --git a/src/applications/mhv/medical-records/actions/vitals.js b/src/applications/mhv/medical-records/actions/vitals.js
index f910c1c8f962..a70415fee34d 100644
--- a/src/applications/mhv/medical-records/actions/vitals.js
+++ b/src/applications/mhv/medical-records/actions/vitals.js
@@ -9,7 +9,7 @@ export const getVitals = () => async dispatch => {
const response = await getVitalsList();
dispatch({ type: Actions.Vitals.GET_LIST, response });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
@@ -20,7 +20,7 @@ export const getVitalDetails = (vitalType, vitalList) => async dispatch => {
}
dispatch({ type: Actions.Vitals.GET, vitalType });
} catch (error) {
- dispatch(addAlert(Constants.ALERT_TYPE_ERROR));
+ dispatch(addAlert(Constants.ALERT_TYPE_ERROR, error));
}
};
diff --git a/src/applications/mhv/medical-records/components/shared/AppRoute.jsx b/src/applications/mhv/medical-records/components/shared/AppRoute.jsx
new file mode 100644
index 000000000000..05316f866a93
--- /dev/null
+++ b/src/applications/mhv/medical-records/components/shared/AppRoute.jsx
@@ -0,0 +1,21 @@
+import React from 'react';
+import { Route } from 'react-router-dom';
+import PropTypes from 'prop-types';
+import App from '../../containers/App';
+
+/**
+ * Route that wraps its children within the application component.
+ */
+const AppRoute = ({ children, ...rest }) => {
+ return (
+
+ {children}
+
+ );
+};
+
+AppRoute.propTypes = {
+ children: PropTypes.object,
+};
+
+export default AppRoute;
diff --git a/src/applications/mhv/medical-records/components/shared/FeatureFlagRoute.jsx b/src/applications/mhv/medical-records/components/shared/FeatureFlagRoute.jsx
index d8ca6b3d9442..d1acaf59643a 100644
--- a/src/applications/mhv/medical-records/components/shared/FeatureFlagRoute.jsx
+++ b/src/applications/mhv/medical-records/components/shared/FeatureFlagRoute.jsx
@@ -2,10 +2,15 @@ import React from 'react';
import { Route } from 'react-router-dom';
import { useSelector } from 'react-redux';
import PropTypes from 'prop-types';
+import App from '../../containers/App';
const FeatureFlagRoute = ({ featureFlag, children, ...rest }) => {
const displayRoute = useSelector(state => state.featureToggles[featureFlag]);
- return displayRoute ? {children} : null;
+ return displayRoute ? (
+
+ {children}
+
+ ) : null;
};
export default FeatureFlagRoute;
diff --git a/src/applications/mhv/medical-records/containers/Allergies.jsx b/src/applications/mhv/medical-records/containers/Allergies.jsx
index 09bc894e4ba3..b3fa3b8d3361 100644
--- a/src/applications/mhv/medical-records/containers/Allergies.jsx
+++ b/src/applications/mhv/medical-records/containers/Allergies.jsx
@@ -54,7 +54,7 @@ const Allergies = props => {
],
);
const user = useSelector(state => state.user.profile);
- const activeAlert = useAlerts();
+ const activeAlert = useAlerts(dispatch);
useListRefresh({
listState,
diff --git a/src/applications/mhv/medical-records/containers/AllergyDetails.jsx b/src/applications/mhv/medical-records/containers/AllergyDetails.jsx
index 3825a46fa80c..5f1a5c50037d 100644
--- a/src/applications/mhv/medical-records/containers/AllergyDetails.jsx
+++ b/src/applications/mhv/medical-records/containers/AllergyDetails.jsx
@@ -46,7 +46,7 @@ const AllergyDetails = props => {
);
const { allergyId } = useParams();
const dispatch = useDispatch();
- const activeAlert = useAlerts();
+ const activeAlert = useAlerts(dispatch);
useEffect(
() => {
diff --git a/src/applications/mhv/medical-records/containers/App.jsx b/src/applications/mhv/medical-records/containers/App.jsx
index d46ab9da15cb..d4c6f7278ca9 100644
--- a/src/applications/mhv/medical-records/containers/App.jsx
+++ b/src/applications/mhv/medical-records/containers/App.jsx
@@ -1,4 +1,4 @@
-import React, { useEffect, useState, useRef } from 'react';
+import React, { useEffect, useState, useRef, useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import {
useLocation,
@@ -7,10 +7,13 @@ import {
import PropTypes from 'prop-types';
import { selectUser } from '@department-of-veterans-affairs/platform-user/selectors';
import { RequiredLoginView } from '@department-of-veterans-affairs/platform-user/RequiredLoginView';
+import { renderMHVDowntime } from '@department-of-veterans-affairs/mhv/exports';
import {
DowntimeNotification,
externalServices,
+ externalServiceStatus,
} from '@department-of-veterans-affairs/platform-monitoring/DowntimeNotification';
+import { getScheduledDowntime } from 'platform/monitoring/DowntimeNotification/actions';
import MrBreadcrumbs from '../components/MrBreadcrumbs';
import ScrollToTop from '../components/shared/ScrollToTop';
import PhrRefresh from '../components/shared/PhrRefresh';
@@ -44,6 +47,36 @@ const App = ({ children }) => {
const [paths, setPaths] = useState([]);
const location = useLocation();
const measuredRef = useRef();
+ const atLandingPage = location.pathname === '/';
+
+ const scheduledDowntimes = useSelector(
+ state => state.scheduledDowntime?.serviceMap || [],
+ );
+ const globalDowntime = useSelector(
+ state => state.scheduledDowntime?.globalDowntime,
+ );
+
+ const mhvMrDown = useMemo(
+ () => {
+ if (scheduledDowntimes.size > 0) {
+ return (
+ scheduledDowntimes?.get(externalServices.mhvMr)?.status ||
+ scheduledDowntimes?.get(externalServices.mhvPlatform)?.status ||
+ scheduledDowntimes?.get(externalServices.global)?.status ||
+ globalDowntime
+ );
+ }
+ return 'downtime status: ok';
+ },
+ [scheduledDowntimes, globalDowntime],
+ );
+
+ useEffect(
+ () => {
+ dispatch(getScheduledDowntime());
+ },
+ [dispatch],
+ );
const datadogRumConfig = {
applicationId: '04496177-4c70-4caf-9d1e-de7087d1d296',
@@ -182,28 +215,43 @@ const App = ({ children }) => {
ref={measuredRef}
className="vads-l-grid-container vads-u-padding-left--2"
>
-
-
-
- Review, print, and download your VA medical records.
-
-
- {displayNotes && (
-
-
- Care summaries and notes
-
-
- Get notes from your VA providers about your health and health
- care. This includes summaries of your stays in health facilities
- (called admission and discharge summaries).
-
-
- Go to your care summaries and notes
-
-
- )}
- {displayVaccines && (
-
-
- Vaccines
-
-
- Get a list of all vaccines (immunizations) in your VA medical
- records.
-
-
- Go to your vaccines
-
-
- )}
+
+
+
+ Medical records
+
+
+
+
+ Review, print, and download your VA medical records.
+
+
+ {displayNotes && (
- Allergies and reactions
+ Care summaries and notes
- Get a list of all allergies, reactions, and side effects in your VA
- medical records. This includes medication side effects (also called
- adverse drug reactions).
+ Get notes from your VA providers about your health and health care.
+ This includes summaries of your stays in health facilities (called
+ admission and discharge summaries).
-
- Go to your allergies and reactions
+
+ Go to your care summaries and notes
+ )}
+ {displayVaccines && (
- How to find your other medical records
-
-
- Right now, only some of your medical records are available here on
- VA.gov. Soon, you’ll be able to find these types of medical records
- on this page:
-
-
-
Lab and test results
- {!displayNotes &&
Care summaries and notes
}
- {!displayVaccines &&
Vaccines
}
-
Health conditions
-
Vitals
-
-
- To find your other medical records now, you’ll need to go back to
- the My HealtheVet website.
-
- What to know as you try out this tool
+ Vaccines
- We’re giving the trusted My HealtheVet medical records tool a new
- home here on VA.gov. And we need your feedback to help us keep
- making this tool better for you and all Veterans.
-
-
- Email your feedback and questions to us at .
-
-
- Note: You still
- have access to your medical records on the My HealtheVet website.
- You can go back to that site at any time.{' '}
-
- Go back to medical records on the My HealtheVet website
-
+ Get a list of all vaccines (immunizations) in your VA medical
+ records.
+
+ Go to your vaccines
+
+ )}
+
+
+ Allergies and reactions
+
+
+ Get a list of all allergies, reactions, and side effects in your VA
+ medical records. This includes medication side effects (also called
+ adverse drug reactions).
+
+
+ Go to your allergies and reactions
+
+
+
+
+ How to find your other medical records
+
+
+ Right now, only some of your medical records are available here on
+ VA.gov. Soon, you’ll be able to find these types of medical records on
+ this page:
+
+
+
Lab and test results
+ {!displayNotes &&
Care summaries and notes
}
+ {!displayVaccines &&
Vaccines
}
+
Health conditions
+
Vitals
+
+
+ To find your other medical records now, you’ll need to go back to the
+ My HealtheVet website.
+
+ We’re giving the trusted My HealtheVet medical records tool a new home
+ here on VA.gov. And we need your feedback to help us keep making this
+ tool better for you and all Veterans.
+
- Right now, only some types of medical records are available here
- on VA.gov. And your records on VA.gov only include health
- information your VA providers have entered.
-
-
- To find other types of medical records
- —
- including health information you entered yourself
- —
- go to your medical records on the My HealtheVet website.
-
- How can I tell my care team that my health information has
- changed?
-
+
+
Questions about this medical records tool
+
+
+
+ What if I can’t find all my medical records?
+
+
+ Right now, only some types of medical records are available here
+ on VA.gov. And your records on VA.gov only include health
+ information your VA providers have entered.
+
+
+ To find other types of medical records
+ —
+ including health information you entered yourself
+ —
+ go to your medical records on the My HealtheVet website.
+
- Will VA protect my personal health information?
-
-
- Yes. This is a secure website. We follow strict security
- policies and practices to protect your personal health
- information. Only you and your VA care team will have access to
- your records.
-
-
- If you print or download any records, you’ll need to take
- responsibility for protecting that information. If you’re on a
- public or shared computer, remember that downloading will save a
- copy of your records to the computer you’re using.
-
-
-
-
- What if I have more questions?
-
-
-
- For questions about health information in your records
-
-
+ Will VA protect my personal health information?
+
+
+ Yes. This is a secure website. We follow strict security policies
+ and practices to protect your personal health information. Only
+ you and your VA care team will have access to your records.
+
+
+ If you print or download any records, you’ll need to take
+ responsibility for protecting that information. If you’re on a
+ public or shared computer, remember that downloading will save a
+ copy of your records to the computer you’re using.
+
+
+
+
+ What if I have more questions?
+
+
+
+ For questions about health information in your records
+
+
+ Only use messages for non-urgent needs. Your care team may take up
+ to{' '}
+ 3 business days{' '}
+ to reply.
+
+
+ If you need help sooner, use one of these urgent communication
+ options:
+
+
+
- 3 business days
+ If you’re in crisis or having thoughts of suicide,
{' '}
- to reply.
-
-
- If you need help sooner, use one of these urgent communication
- options:
-
-
-
-
- If you’re in crisis or having thoughts of suicide,
- {' '}
- connect with our Veterans Crisis Line. We offer confidential
- support anytime, day or night.
-
-
-
-
-
-
- If you think your life or health is in danger,
- {' '}
- call 911 or go to the nearest emergency room.
-
-
-
+ connect with our Veterans Crisis Line. We offer confidential
+ support anytime, day or night.
+
+
+
+
+
- For questions about how to use this tool
-
-
-
- Email us at .
-
-
-
-
-
- >
+ If you think your life or health is in danger,
+ {' '}
+ call 911 or go to the nearest emergency room.
+
+
+
- Confirmation number
-
- {response?.confirmationNumber}
-
- )}
-
- Pension Management Center
+
+
Your Veterans Pension application
+
+
+
Thank you for submitting your Veterans Pension application.
+
+ We've received your Veterans Pension application (VA Form
+ 21P-527EZ). After we complete our review, we'll mail you a decision
+ letter with the details of our decision.
+
+ You can submit supporting documents in one of 2 ways:
+
+
Submit your documents online through AccessVA
+
+
+ You can use the QuickSubmit tool through AccessVA to submit your
+ documents online.
+
+
+
+
+
Mail copies of your documents
+
+
+ Don’t mail us a printed copy of your pension application. We
+ already have your application. If you need to submit supporting
+ documents, you can mail copies of your documents to us at this
+ address:
+
+
+ Department of Veterans Affairs
- {pmcName && {pmcName}}
+ Pension Intake Center
-
- Phone: ,
- Monday – – Friday, 8:00 a.m. – 9:00 p.m. ET
-
+ PO Box 5365
- Fax: 844-655-1604
-
-
-
- If you have several documents to send in, you can mail them to:
-
-
- {regionalOffice?.map((line, index) => (
-
{line}
- ))}
-
-
-
- Note: If you choose to mail in your supporting
- documents, you don't have to send in a paper copy of VA Form
- 21P-527EZ with the documents.
-
-
-
-
-
Need help?
-
- If you have questions,
-
- Monday – Friday, 8:00 a.m. – 9:00 p.m. ET.
- Please have your Social Security number or VA file number ready.
-
+ Note: Don't send us your original documents. We
+ can't return them. Mail us copies of your documents only.
+
+
+ If we asked you to complete and submit additional forms, be sure
+ to make copies of the forms for your records before you mail them
+ to us.
+
-
+
+
+
+
What to expect next
+
+ You don't need to do anything while you wait for a decision unless
+ we send you a letter to ask you for more information. If we send you
+ a request for more information, you’ll need to respond within 30
+ days of our request. If you don't respond within 30 days, we may
+ decide your claim with the evidence that's available to us.
+
+
+ If you’ve opted to receive VA emails or texts, we’ll send you
+ updates about the status of your application.
+
+
+ You can also{' '}
+
+
+
+ Note: It may take 7 to 10 days after you apply for
+ your pension claim to appear online.
+
+
+
+
+
How to contact us if you have questions
+
+ You can ask us a question{' '}
+
+
+
+ Or call us at {' '}
+
+
+
);
}
diff --git a/src/applications/pensions/labels.jsx b/src/applications/pensions/labels.jsx
index 0305b46d129d..dc94a748c719 100644
--- a/src/applications/pensions/labels.jsx
+++ b/src/applications/pensions/labels.jsx
@@ -33,3 +33,11 @@ export const serviceBranchLabels = {
usphs: 'USPHS',
noaa: 'NOAA',
};
+
+export const typeOfIncomeLabels = {
+ SOCIAL_SECURITY: 'Social Security',
+ INTEREST_DIVIDEND: 'Interest or dividend income',
+ CIVIL_SERVICE: 'Civil Service',
+ PENSION_RETIREMENT: 'Pension or retirement income',
+ OTHER: 'Other income',
+};
diff --git a/src/applications/pensions/tests/unit/components/DependentField.unit.spec.jsx b/src/applications/pensions/tests/unit/components/DependentField.unit.spec.jsx
deleted file mode 100644
index 46b9661cc6d5..000000000000
--- a/src/applications/pensions/tests/unit/components/DependentField.unit.spec.jsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import { expect } from 'chai';
-import SkinDeep from 'skin-deep';
-
-import DependentField from '../../../components/DependentField';
-
-describe('Pensions DependentField', () => {
- it('should render', () => {
- const tree = SkinDeep.shallowRender(
- ,
- );
-
- expect(tree.text()).to.contain('Jane Doe');
- expect(tree.text()).to.contain('Child');
- });
-});
diff --git a/src/applications/pensions/tests/unit/containers/ConfirmationPage.unit.spec.jsx b/src/applications/pensions/tests/unit/containers/ConfirmationPage.unit.spec.jsx
index 746421691519..3d477d03b5b2 100644
--- a/src/applications/pensions/tests/unit/containers/ConfirmationPage.unit.spec.jsx
+++ b/src/applications/pensions/tests/unit/containers/ConfirmationPage.unit.spec.jsx
@@ -60,38 +60,44 @@ describe('', () => {
const form = generateForm();
const tree = SkinDeep.shallowRender();
- expect(tree.subTree('.confirmation-page-title').text()).to.equal(
- 'Claim submitted',
+ const heading = tree.everySubTree('h2');
+ expect(heading.length).to.eql(1);
+ expect(heading[0]?.text()).to.equal('Your Veterans Pension application');
+
+ const alert = tree.everySubTree('va-alert', { status: 'success' });
+ expect(alert.length).to.eql(1);
+
+ const info = tree.everySubTree('va-summary-box');
+ expect(info.length).to.eql(1);
+ expect(info[0]?.subTree('va-button').props.text).to.equal(
+ 'Print this page for your records',
);
- expect(
- tree
- .everySubTree('span')[1]
- .text()
- .trim(),
- ).to.equal('for Jane Doe');
- expect(tree.everySubTree('li')[2].text()).to.contain('Western Region');
- expect(tree.everySubTree('p')[0].text()).to.contain(
- 'We process claims in the order we receive them',
+
+ const sections = tree.everySubTree('section');
+ expect(sections.length).to.eql(3);
+ expect(sections[0].subTree('h3').text()).to.equal(
+ 'If you need to submit supporting documents',
);
- expect(tree.everySubTree('p')[1].text()).to.contain(
- 'We may contact you for more information or documents.',
+ expect(sections[1].subTree('h3').text()).to.equal('What to expect next');
+ expect(sections[2].subTree('h3').text()).to.equal(
+ 'How to contact us if you have questions',
);
- expect(tree.everySubTree('p')[3].text()).to.contain('VA Regional Office');
- });
- it('should render with empty regionalOffice', () => {
- const form = generateForm({ hasRegionalOffice: false });
- const tree = shallow();
+ const address = tree.everySubTree('p', { className: 'va-address-block' });
+ expect(address.length).to.eql(1);
- expect(tree.find('address').children().length).to.eql(0);
- tree.unmount();
+ const phoneNums = tree.everySubTree('va-telephone');
+ expect(phoneNums.length).to.eql(2);
+ expect(phoneNums[0].props.international).to.be.true;
+ expect(phoneNums[1].props.tty).to.be.true;
});
it('should render if no submission response', () => {
const form = generateForm({ hasResponse: false });
const tree = shallow();
- expect(tree.find('.claim-list').children().length).to.eql(4);
+ const confirmation = tree.find('#pension_527ez_submission_confirmation');
+ expect(confirmation.length).to.eql(0);
tree.unmount();
});
});
diff --git a/src/applications/personalization/common/hooks/useSessionStorage.unit.spec.js b/src/applications/personalization/common/hooks/useSessionStorage.unit.spec.js
index 31f22192109e..5126412c4e8b 100644
--- a/src/applications/personalization/common/hooks/useSessionStorage.unit.spec.js
+++ b/src/applications/personalization/common/hooks/useSessionStorage.unit.spec.js
@@ -1,6 +1,12 @@
import React from 'react';
import { expect } from 'chai';
-import { render, act, fireEvent, waitFor } from '@testing-library/react';
+import {
+ render,
+ act,
+ fireEvent,
+ waitFor,
+ cleanup,
+} from '@testing-library/react';
import sinon from 'sinon';
import PropTypes from 'prop-types';
@@ -33,6 +39,7 @@ TestComponent.propTypes = {
};
describe('useSessionStorage', () => {
+ afterEach(cleanup);
const testKey = 'testKey';
it('retrieves an existing value from sessionStorage', () => {
diff --git a/src/applications/personalization/profile/components/account-security/AccountSecurityContent.jsx b/src/applications/personalization/profile/components/account-security/AccountSecurityContent.jsx
index 6672e92f46ce..7f1f1fccc47d 100644
--- a/src/applications/personalization/profile/components/account-security/AccountSecurityContent.jsx
+++ b/src/applications/personalization/profile/components/account-security/AccountSecurityContent.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { connect } from 'react-redux';
+import { connect, useSelector } from 'react-redux';
import { recordCustomProfileEvent } from '@@vap-svc/util/analytics';
import {
@@ -14,8 +14,23 @@ import IdentityNotVerified from '~/platform/user/authorization/components/Identi
import MPIConnectionError from '~/applications/personalization/components/MPIConnectionError';
import NotInMPIError from '~/applications/personalization/components/NotInMPIError';
import { AccountSecurityTables } from './AccountSecurityTables';
-import { selectIsBlocked } from '../../selectors';
+import {
+ selectIsBlocked,
+ selectShowCredRetirementMessaging,
+} from '../../selectors';
import { AccountBlocked } from '../alerts/AccountBlocked';
+import { AccountSecurityLoa1CredAlert } from '../alerts/CredentialRetirementAlerts';
+
+const IdNotVerifiedContent = () => {
+ const showCredRetirementMessaging = useSelector(
+ selectShowCredRetirementMessaging,
+ );
+ return showCredRetirementMessaging ? (
+
+ ) : (
+
+ );
+};
export const AccountSecurityContent = ({
isIdentityVerified,
@@ -29,7 +44,7 @@ export const AccountSecurityContent = ({
{isBlocked && (
)}
- {!isIdentityVerified && }
+ {!isIdentityVerified && }
{showMPIConnectionError && (
)}
diff --git a/src/applications/personalization/profile/components/account-security/AccountSecurityTables.jsx b/src/applications/personalization/profile/components/account-security/AccountSecurityTables.jsx
index 6b48827b668b..c16ec2cd9624 100644
--- a/src/applications/personalization/profile/components/account-security/AccountSecurityTables.jsx
+++ b/src/applications/personalization/profile/components/account-security/AccountSecurityTables.jsx
@@ -81,11 +81,12 @@ export const AccountSecurityTables = ({
);
return (
<>
- {/* legacy toble view for email address table */}
}
+ data={
+
+ }
className="vads-u-margin-bottom--2"
/>
diff --git a/src/applications/personalization/profile/components/alerts/CredentialRetirementAlerts.jsx b/src/applications/personalization/profile/components/alerts/CredentialRetirementAlerts.jsx
new file mode 100644
index 000000000000..eabd748932f3
--- /dev/null
+++ b/src/applications/personalization/profile/components/alerts/CredentialRetirementAlerts.jsx
@@ -0,0 +1,95 @@
+import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
+import React from 'react';
+import { VaAlert } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
+import { useSignInServiceProvider } from '../../hooks';
+import { HowToVerifyLink } from '~/platform/user/authorization/components/IdentityNotVerified';
+import { useSessionStorage } from '../../../common/hooks/useSessionStorage';
+
+// alerts to be used during the transition period of MHV and DS Logon credential retirement
+
+export const AccountSecurityLoa1CredAlert = () => {
+ const { label } = useSignInServiceProvider();
+
+ return (
+ <>
+
+
+ Verify your identity with Login.gov or ID.me to manage your profile
+ information
+
+
+
+ Before we give you access to your VA.gov profile, we need to make
+ sure you’re you—and not someone pretending to be you. This helps us
+ protect your identity and prevent fraud.
+
+
+ If you have a verified Login.gov or ID.me account, sign out now.
+ Then sign back in with that account to continue.
+
+
+ {`If you don’t have one of these accounts, you can create one and
+ verify your identity now. Starting December 31, 2024, you’ll no
+ longer be able to sign in with your ${label} username and password.`}
+
+
+
+
+
+ Note: If you need help updating your personal
+ information, call us at{' '}
+ (
+
+ ). We’re here Monday through Friday, 8:00 a.m. to 9:00 p.m. ET.
+
+ {`Starting December 31, 2024, you’ll no longer be able to sign in with
+ your ${label} username and password. You’ll need to use a verified
+ Login.gov or ID.me account to access your profile.`}
+
+
+
+ If you don’t have one of these accounts, you can create one and verify
+ your identity now.
+
To access or update your sign-in information, go to the website where
you manage your account information. Any updates you make there will
@@ -20,4 +31,9 @@ const SignInServiceUpdateLink = () => {
);
};
+// this prop will be removed once MHV and DS Logon are fully retired
+SignInServiceUpdateLink.propTypes = {
+ isIdentityVerified: PropTypes.bool.isRequired,
+};
+
export default SignInServiceUpdateLink;
diff --git a/src/applications/personalization/profile/mocks/endpoints/feature-toggles/index.js b/src/applications/personalization/profile/mocks/endpoints/feature-toggles/index.js
index 0db6928cca16..d3cb2ad0bf27 100644
--- a/src/applications/personalization/profile/mocks/endpoints/feature-toggles/index.js
+++ b/src/applications/personalization/profile/mocks/endpoints/feature-toggles/index.js
@@ -11,6 +11,7 @@ const profileToggles = {
profileShowMhvNotificationSettings: false,
profileUseExperimental: false,
profileShowQuickSubmitNotificationSetting: false,
+ profileShowCredentialRetirementMessaging: false,
profileShowEmailNotificationSettings: false,
profileShowProofOfVeteranStatus: false,
};
diff --git a/src/applications/personalization/profile/mocks/endpoints/user/index.js b/src/applications/personalization/profile/mocks/endpoints/user/index.js
index 1e1959a44cb6..230a86db1ec3 100644
--- a/src/applications/personalization/profile/mocks/endpoints/user/index.js
+++ b/src/applications/personalization/profile/mocks/endpoints/user/index.js
@@ -1411,6 +1411,20 @@ const mockErrorResponses = {
},
};
+// user that is loa1 but is a dslogon user
+const loa1UserDSLogon = set(
+ cloneDeep(baseUserResponses.loa1User),
+ 'data.attributes.profile.signIn.serviceName',
+ 'dslogon',
+);
+
+// user that is loa1 but is a mhv user
+const loa1UserMHV = set(
+ cloneDeep(baseUserResponses.loa1User),
+ 'data.attributes.profile.signIn.serviceName',
+ 'mhv',
+);
+
// users with various contact info missing
const loa3UserWithNoMobilePhone = set(
cloneDeep(baseUserResponses.loa3User72),
@@ -1459,6 +1473,8 @@ const loa3UserWithoutMailingAddress = set(
const responses = {
...baseUserResponses,
...mockErrorResponses,
+ loa1UserDSLogon,
+ loa1UserMHV,
loa3UserWithNoMobilePhone,
loa3UserWithNoEmail,
loa3UserWithNoEmailOrMobilePhone,
diff --git a/src/applications/personalization/profile/mocks/server.js b/src/applications/personalization/profile/mocks/server.js
index e5d8df0adcfa..144b31987b71 100644
--- a/src/applications/personalization/profile/mocks/server.js
+++ b/src/applications/personalization/profile/mocks/server.js
@@ -63,6 +63,7 @@ const responses = {
authExpVbaDowntimeMessage: false,
profileContacts: true,
profileHideDirectDepositCompAndPen: false,
+ profileShowCredentialRetirementMessaging: true,
profileShowEmailNotificationSettings: true,
profileShowMhvNotificationSettings: true,
profileShowPaymentsNotificationSetting: true,
@@ -77,12 +78,13 @@ const responses = {
'GET /v0/user': (_req, res) => {
// return res.status(403).json(genericErrors.error500);
// example user data cases
- return res.json(user.loa3User72); // default user (success)
+ return res.json(user.loa3User72); // default user LOA3 w/id.me (success)
// return res.json(user.dsLogonUser); // user with dslogon signIn.serviceName
// return res.json(user.mvhUser); // user with mhv signIn.serviceName
- // return res.json(user.loa1User); // user with loa1
+ // return res.json(user.loa1User); // LOA1 user w/id.me
+ // return res.json(user.loa1UserDSLogon); // LOA1 user w/dslogon
+ // return res.json(user.loa1UserMHV); // LOA1 user w/mhv
// return res.json(user.badAddress); // user with bad address
- // return res.json(user.loa3User); // user with loa3
// return res.json(user.nonVeteranUser); // non-veteran user
// return res.json(user.externalServiceError); // external service error
// return res.json(user.loa3UserWithNoMobilePhone); // user with no mobile phone number
@@ -217,7 +219,7 @@ const responses = {
return res.json(address.homeAddressUpdateReceived.response);
},
'GET /v0/profile/status/:id': (req, res) => {
- // uncomment this to simlulate multiple status calls
+ // uncomment this to simulate multiple status calls
// aka long latency on getting update to go through
// if (retries < 2) {
// retries += 1;
diff --git a/src/applications/personalization/profile/selectors.js b/src/applications/personalization/profile/selectors.js
index 8cef91b72086..d93c4ea0ba6c 100644
--- a/src/applications/personalization/profile/selectors.js
+++ b/src/applications/personalization/profile/selectors.js
@@ -3,6 +3,7 @@ import { createSelector } from 'reselect';
import { toggleValues } from '~/platform/site-wide/feature-toggles/selectors';
import FEATURE_FLAG_NAMES from '~/platform/utilities/feature-toggles/featureFlagNames';
+import { CSP_IDS } from '~/platform/user/authentication/constants';
import {
cnpDirectDepositBankInfo,
@@ -144,3 +145,16 @@ export const selectProfileShowProofOfVeteranStatusToggle = state =>
toggleValues(state)?.[FEATURE_FLAG_NAMES.profileShowProofOfVeteranStatus];
export const selectProfileContacts = state => state?.profileContacts || {};
+
+export const selectHasRetiringSignInService = state => {
+ const serviceName = state?.user?.profile?.signIn?.serviceName;
+ return !serviceName || [CSP_IDS.DS_LOGON, CSP_IDS.MHV].includes(serviceName);
+};
+
+export const selectShowCredRetirementMessaging = state => {
+ return (
+ toggleValues(state)?.[
+ FEATURE_FLAG_NAMES.profileShowCredentialRetirementMessaging
+ ] && selectHasRetiringSignInService(state)
+ );
+};
diff --git a/src/applications/personalization/profile/tests/components/account-security/AccountSecurity.unit.spec.jsx b/src/applications/personalization/profile/tests/components/account-security/AccountSecurity.unit.spec.jsx
index d5791f2701fc..a6635fb8ce84 100644
--- a/src/applications/personalization/profile/tests/components/account-security/AccountSecurity.unit.spec.jsx
+++ b/src/applications/personalization/profile/tests/components/account-security/AccountSecurity.unit.spec.jsx
@@ -1,35 +1,41 @@
import React from 'react';
-import { shallow } from 'enzyme';
import { expect } from 'chai';
+import { cleanup } from '@testing-library/react';
+import AccountSecurity from '../../../components/account-security/AccountSecurity';
+import {
+ createCustomProfileState,
+ renderWithProfileReducersAndRouter,
+} from '../../unit-test-helpers';
-import DowntimeNotification, {
- externalServices,
-} from 'platform/monitoring/DowntimeNotification';
+describe('AccountSecurity Page', () => {
+ afterEach(cleanup);
-import ProfileSectionHeadline from '@@profile/components/ProfileSectionHeadline';
-import AccountSecurity from '@@profile/components/account-security/AccountSecurity';
-import AccountSecurityContent from '@@profile/components/account-security/AccountSecurityContent';
-
-describe('AccountSecurity', () => {
- let wrapper;
- beforeEach(() => {
- wrapper = shallow();
- });
- afterEach(() => {
- wrapper.unmount();
+ it('renders without crashing', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: createCustomProfileState(),
+ },
+ );
+ expect(getByText('Account security')).to.exist;
});
- it('renders a ProfileSectionHeadline component as its first child', () => {
- const firstChild = wrapper.childAt(0);
- expect(firstChild.type()).to.equal(ProfileSectionHeadline);
+
+ it('sets the document title on mount', () => {
+ renderWithProfileReducersAndRouter(, {
+ initialState: createCustomProfileState(),
+ });
+ expect(document.title).to.equal('Account Security | Veterans Affairs');
});
- it('renders a properly configured DowntimeNotification component as its second child', () => {
- const secondChild = wrapper.childAt(1);
- expect(secondChild.type()).to.equal(DowntimeNotification);
- expect(secondChild.prop('dependencies')).to.deep.equal([
- externalServices.emis,
- externalServices.mvi,
- ]);
- expect(secondChild.children().type()).to.equal(AccountSecurityContent);
+ it('renders main section headings of account security page', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: createCustomProfileState(),
+ },
+ );
+
+ expect(getByText('Sign-in information')).to.exist;
+ expect(getByText('Account setup')).to.exist;
});
});
diff --git a/src/applications/personalization/profile/tests/components/account-security/AccountSecurityContent.unit.spec.jsx b/src/applications/personalization/profile/tests/components/account-security/AccountSecurityContent.unit.spec.jsx
new file mode 100644
index 000000000000..2a8df458a556
--- /dev/null
+++ b/src/applications/personalization/profile/tests/components/account-security/AccountSecurityContent.unit.spec.jsx
@@ -0,0 +1,158 @@
+import React from 'react';
+import { expect } from 'chai';
+import { cleanup } from '@testing-library/react';
+import { within } from '@testing-library/dom';
+import { CSP_IDS } from '~/platform/user/authentication/constants';
+import AccountSecurityContent from '../../../components/account-security/AccountSecurityContent';
+import {
+ createCustomProfileState,
+ createFeatureTogglesState,
+ renderWithProfileReducersAndRouter,
+} from '../../unit-test-helpers';
+import { Toggler } from '~/platform/utilities/feature-toggles';
+
+describe('AccountSecurityContent component', () => {
+ afterEach(cleanup);
+
+ it('renders without crashing', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: {
+ ...createCustomProfileState({
+ user: {
+ profile: {
+ signIn: { serviceName: CSP_IDS.DS_LOGON },
+ loa: { current: 1 },
+ },
+ },
+ }),
+ ...createFeatureTogglesState({
+ [Toggler.TOGGLE_NAMES
+ .profileShowCredentialRetirementMessaging]: true,
+ }),
+ },
+ },
+ );
+
+ expect(getByText('Sign-in information')).to.exist;
+ expect(getByText('Account setup')).to.exist;
+ });
+
+ it('renders credential retirement alert when using DS Logon signIn.serviceName', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: {
+ ...createCustomProfileState({
+ user: {
+ profile: {
+ signIn: { serviceName: CSP_IDS.DS_LOGON },
+ loa: { current: 1 },
+ },
+ },
+ }),
+ ...createFeatureTogglesState({
+ [Toggler.TOGGLE_NAMES
+ .profileShowCredentialRetirementMessaging]: true,
+ }),
+ },
+ },
+ );
+
+ expect(
+ getByText(
+ 'Verify your identity with Login.gov or ID.me to manage your profile information',
+ {
+ exact: false,
+ },
+ ),
+ 'heading for alert exists when DS Logon is used',
+ ).to.exist;
+
+ expect(
+ getByText(
+ 'Starting December 31, 2024, you’ll no longer be able to sign in with your DS Logon username and password.',
+ {
+ exact: false,
+ },
+ ),
+ 'content for alert exists when DS Logon is used',
+ ).to.exist;
+ });
+
+ it('renders credential retirement alert when using MHV signIn.serviceName', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: {
+ ...createCustomProfileState({
+ user: {
+ profile: {
+ signIn: { serviceName: CSP_IDS.MHV },
+ loa: { current: 1 },
+ },
+ },
+ }),
+ ...createFeatureTogglesState({
+ [Toggler.TOGGLE_NAMES
+ .profileShowCredentialRetirementMessaging]: true,
+ }),
+ },
+ },
+ );
+
+ expect(
+ getByText(
+ 'Verify your identity with Login.gov or ID.me to manage your profile information',
+ {
+ exact: false,
+ },
+ ),
+ 'heading for alert exists when MHV is used',
+ ).to.exist;
+
+ expect(
+ getByText(
+ 'Starting December 31, 2024, you’ll no longer be able to sign in with your My HealtheVet username and password.',
+ {
+ exact: false,
+ },
+ ),
+ 'content for alert exists when MHV is used',
+ ).to.exist;
+ });
+
+ it('renders regular identity not verified alert when user is not verified and id.me', () => {
+ const { getByText, container } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: {
+ ...createCustomProfileState({
+ user: {
+ profile: {
+ signIn: { serviceName: CSP_IDS.ID_ME },
+ loa: { current: 1 },
+ },
+ },
+ }),
+ ...createFeatureTogglesState({
+ [Toggler.TOGGLE_NAMES
+ .profileShowCredentialRetirementMessaging]: false,
+ }),
+ },
+ },
+ );
+
+ expect(
+ getByText('Verify your identity to access your complete profile'),
+ 'heading for alert exists when user is not verified',
+ ).to.exist;
+
+ const alert = container.querySelector('va-alert');
+ expect(
+ within(alert).getByRole('link', { name: 'Verify your identity' }),
+ 'verify identity link exists when user is not verified',
+ ).to.exist;
+ });
+});
diff --git a/src/applications/personalization/profile/tests/components/alerts/CredentialRetirementAlerts.unit.spec.jsx b/src/applications/personalization/profile/tests/components/alerts/CredentialRetirementAlerts.unit.spec.jsx
new file mode 100644
index 000000000000..39f1ec43ec96
--- /dev/null
+++ b/src/applications/personalization/profile/tests/components/alerts/CredentialRetirementAlerts.unit.spec.jsx
@@ -0,0 +1,89 @@
+import React from 'react';
+import { expect } from 'chai';
+import { cleanup } from '@testing-library/react';
+import {
+ createCustomProfileState,
+ renderWithProfileReducersAndRouter,
+} from '../../unit-test-helpers';
+import { CSP_IDS } from '~/platform/user/authentication/constants';
+
+import {
+ AccountSecurityLoa1CredAlert,
+ SignInEmailAlert,
+} from '../../../components/alerts/CredentialRetirementAlerts';
+
+describe('AccountSecurityLoa1CredAlert', () => {
+ afterEach(cleanup);
+
+ it('renders alert with DS_LOGON service provider in text', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: createCustomProfileState({
+ user: { profile: { signIn: { serviceName: CSP_IDS.DS_LOGON } } },
+ }),
+ },
+ );
+
+ expect(
+ getByText('sign in with your DS Logon username and password', {
+ exact: false,
+ }),
+ ).to.exist;
+ });
+
+ it('renders alert with MHV service provider in text', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: createCustomProfileState({
+ user: { profile: { signIn: { serviceName: CSP_IDS.MHV } } },
+ }),
+ },
+ );
+
+ expect(
+ getByText('sign in with your My HealtheVet username and password', {
+ exact: false,
+ }),
+ ).to.exist;
+ });
+});
+
+describe('SignInEmailAlert', () => {
+ afterEach(cleanup);
+
+ it('renders alert with DS_LOGON service provider in text', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: createCustomProfileState({
+ user: { profile: { signIn: { serviceName: CSP_IDS.DS_LOGON } } },
+ }),
+ },
+ );
+
+ expect(
+ getByText('sign in with your DS Logon username and password', {
+ exact: false,
+ }),
+ ).to.exist;
+ });
+
+ it('renders alert with MHV service provider in text', () => {
+ const { getByText } = renderWithProfileReducersAndRouter(
+ ,
+ {
+ initialState: createCustomProfileState({
+ user: { profile: { signIn: { serviceName: CSP_IDS.MHV } } },
+ }),
+ },
+ );
+
+ expect(
+ getByText('sign in with your My HealtheVet username and password', {
+ exact: false,
+ }),
+ ).to.exist;
+ });
+});
diff --git a/src/applications/personalization/profile/tests/e2e/account-security/credential-retirement-alert.cypress.spec.js b/src/applications/personalization/profile/tests/e2e/account-security/credential-retirement-alert.cypress.spec.js
new file mode 100644
index 000000000000..36f1d72fceba
--- /dev/null
+++ b/src/applications/personalization/profile/tests/e2e/account-security/credential-retirement-alert.cypress.spec.js
@@ -0,0 +1,110 @@
+import { PROFILE_PATHS } from '../../../constants';
+
+import fullName from '../../fixtures/full-name-success.json';
+import personalInformation from '../../fixtures/personal-information-success-enhanced.json';
+import serviceHistory from '../../fixtures/service-history-success.json';
+import { generateFeatureToggles } from '../../../mocks/endpoints/feature-toggles';
+import {
+ dsLogonUser,
+ mvhUser,
+ loa1User,
+ loa1UserDSLogon,
+ loa1UserMHV,
+} from '../../../mocks/endpoints/user';
+import { findVaLinkByText } from '../../../../common/e2eHelpers';
+
+context('credential retirement alerts on account security', () => {
+ beforeEach(() => {
+ cy.intercept('v0/profile/full_name', fullName);
+ cy.intercept('v0/profile/personal_information', personalInformation);
+ cy.intercept('v0/profile/service_history', () => serviceHistory);
+ cy.intercept(
+ 'GET',
+ '/v0/feature_toggles*',
+ generateFeatureToggles({
+ profileShowCredentialRetirementMessaging: true,
+ }),
+ );
+ });
+
+ it('should show credential retirement alert content for DS Logon account', () => {
+ cy.login(dsLogonUser);
+
+ cy.visit(PROFILE_PATHS.ACCOUNT_SECURITY);
+
+ cy.findByText(
+ `you’ll no longer be able to sign in with your DS Logon username and password`,
+ { exact: false },
+ );
+
+ findVaLinkByText('Learn how to create an account').should('exist');
+
+ cy.injectAxeThenAxeCheck();
+ });
+
+ it('should show credential retirement alert content for MHV account', () => {
+ cy.login(mvhUser);
+
+ cy.visit(PROFILE_PATHS.ACCOUNT_SECURITY);
+
+ cy.findByText(
+ `you’ll no longer be able to sign in with your My HealtheVet username and password`,
+ { exact: false },
+ );
+
+ findVaLinkByText('Learn how to create an account').should('exist');
+
+ cy.injectAxeThenAxeCheck();
+ });
+
+ it('should show credential retirement alert content for LOA1 - DS Logon users', () => {
+ cy.login(loa1UserDSLogon);
+
+ cy.visit(PROFILE_PATHS.ACCOUNT_SECURITY);
+
+ cy.findByText(
+ `Verify your identity with Login.gov or ID.me to manage your profile information`,
+ { exact: false },
+ );
+
+ cy.findByText(
+ `Starting December 31, 2024, you’ll no longer be able to sign in with your DS Logon username and password.`,
+ { exact: false },
+ );
+
+ cy.injectAxeThenAxeCheck();
+ });
+
+ it('should show credential retirement alert content for LOA1 - MHV users', () => {
+ cy.login(loa1UserMHV);
+
+ cy.visit(PROFILE_PATHS.ACCOUNT_SECURITY);
+
+ cy.findByText(
+ `Verify your identity with Login.gov or ID.me to manage your profile information`,
+ { exact: false },
+ );
+
+ cy.findByText(
+ `Starting December 31, 2024, you’ll no longer be able to sign in with your My HealtheVet username and password.`,
+ { exact: false },
+ );
+
+ cy.injectAxeThenAxeCheck();
+ });
+
+ it('should show standard verify identity alert content for LOA1 - id.me users', () => {
+ cy.login(loa1User);
+
+ cy.visit(PROFILE_PATHS.ACCOUNT_SECURITY);
+
+ cy.get('va-alert').within(() => {
+ cy.findByText('Verify your identity to access your complete profile', {
+ exact: false,
+ });
+ cy.findByRole('link', { name: /verify your identity/i });
+ });
+
+ cy.injectAxeThenAxeCheck();
+ });
+});
diff --git a/src/applications/personalization/profile/tests/unit-test-helpers.js b/src/applications/personalization/profile/tests/unit-test-helpers.js
index 9b5135dacdfd..98c21fe2a758 100644
--- a/src/applications/personalization/profile/tests/unit-test-helpers.js
+++ b/src/applications/personalization/profile/tests/unit-test-helpers.js
@@ -4,7 +4,8 @@ import { Formik } from 'formik';
import profile from '@@profile/reducers';
import connectedApps from '@@profile/components/connected-apps/reducers/connectedApps';
-import { snakeCase } from 'lodash';
+import snakeCase from 'lodash/snakeCase';
+import merge from 'lodash/merge';
import {
renderInReduxProvider,
renderWithStoreAndRouter,
@@ -213,6 +214,25 @@ export function createBasicInitialState() {
};
}
+const loa3State = {
+ user: {
+ profile: {
+ loa: { current: 3 },
+ verified: true,
+ multifactor: true,
+ signIn: {
+ serviceName: 'idme',
+ accountType: 'N/A',
+ },
+ },
+ },
+};
+
+export function createCustomProfileState(profileState = { ...loa3State }) {
+ const customState = merge(loa3State, profileState);
+ return merge(createBasicInitialState(), customState);
+}
+
export function createFeatureTogglesState(customToggles = {}) {
// Convert the custom toggles to snake case so that they could be passed in as camel case first
const snakeCasedToggles = Object.entries(customToggles).reduce(
diff --git a/src/applications/pre-need-integration/config/form.jsx b/src/applications/pre-need-integration/config/form.jsx
index 8aaa4a4579c5..fd4b5c2c2b20 100644
--- a/src/applications/pre-need-integration/config/form.jsx
+++ b/src/applications/pre-need-integration/config/form.jsx
@@ -62,11 +62,22 @@ import {
relationshipToVetPreparerDescription,
relationshipToVetOptions,
relationshipToVetPreparerOptions,
+ veteranApplicantDetailsSubHeader,
+ veteranApplicantDetailsPreparerSubHeader,
+ veteranApplicantDetailsPreparerDescription,
+ nonPreparerFullMaidenNameUI,
+ preparerFullMaidenNameUI,
+ ssnDashesUI,
+ preparerSsnDashesUI,
+ nonPreparerDateOfBirthUI,
+ preparerDateOfBirthUI,
// partial implementation of story resolving the address change:
// applicantDetailsCityTitle,
// applicantDetailsStateTitle,
// applicantDetailsPreparerCityTitle,
// applicantDetailsPreparerStateTitle,
+ applicantDemographicsSubHeader,
+ applicantDemographicsPreparerSubHeader,
applicantDemographicsGenderTitle,
applicantDemographicsMaritalStatusTitle,
applicantDemographicsPreparerGenderTitle,
@@ -261,16 +272,20 @@ const formConfig = {
schema: applicantRelationshipToVet.schema,
},
veteranApplicantDetails: {
- title: 'Applicant details',
+ title: 'Your details',
path: 'veteran-applicant-details',
depends: formData =>
!isAuthorizedAgent(formData) && isVeteran(formData),
- uiSchema: veteranApplicantDetails
- .uiSchema
+ uiSchema: veteranApplicantDetails.uiSchema(
// partial implementation of story resolving the address change:
// applicantDetailsCityTitle,
// applicantDetailsStateTitle,
- (),
+ veteranApplicantDetailsSubHeader,
+ '',
+ nonPreparerFullMaidenNameUI,
+ ssnDashesUI,
+ nonPreparerDateOfBirthUI,
+ ),
schema: veteranApplicantDetails.schema,
},
veteranApplicantDetailsPreparer: {
@@ -278,12 +293,16 @@ const formConfig = {
path: 'veteran-applicant-details-preparer',
depends: formData =>
isAuthorizedAgent(formData) && isVeteran(formData),
- uiSchema: veteranApplicantDetails
- .uiSchema
+ uiSchema: veteranApplicantDetails.uiSchema(
// partial implementation of story resolving the address change:
// applicantDetailsPreparerCityTitle,
// applicantDetailsPreparerStateTitle,
- (),
+ veteranApplicantDetailsPreparerSubHeader,
+ veteranApplicantDetailsPreparerDescription,
+ preparerFullMaidenNameUI,
+ preparerSsnDashesUI,
+ preparerDateOfBirthUI,
+ ),
schema: veteranApplicantDetails.schema,
},
nonVeteranApplicantDetails: {
@@ -308,11 +327,12 @@ const formConfig = {
schema: applicantContactInfo.schema,
},
applicantDemographics: {
- title: 'Applicant demographics',
+ title: 'Your demographics',
path: 'applicant-demographics',
depends: formData =>
!isAuthorizedAgent(formData) && isVeteran(formData),
uiSchema: applicantDemographics.uiSchema(
+ applicantDemographicsSubHeader,
applicantDemographicsGenderTitle,
applicantDemographicsMaritalStatusTitle,
),
@@ -324,6 +344,7 @@ const formConfig = {
depends: formData =>
isAuthorizedAgent(formData) && isVeteran(formData),
uiSchema: applicantDemographics.uiSchema(
+ applicantDemographicsPreparerSubHeader,
applicantDemographicsPreparerGenderTitle,
applicantDemographicsPreparerMaritalStatusTitle,
),
@@ -334,6 +355,7 @@ const formConfig = {
depends: formData =>
!isAuthorizedAgent(formData) && isVeteran(formData),
uiSchema: applicantDemographics2.uiSchema(
+ applicantDemographicsSubHeader,
applicantDemographicsEthnicityTitle,
applicantDemographicsRaceTitle,
),
@@ -344,6 +366,7 @@ const formConfig = {
depends: formData =>
isAuthorizedAgent(formData) && isVeteran(formData),
uiSchema: applicantDemographics2.uiSchema(
+ applicantDemographicsPreparerSubHeader,
applicantDemographicsPreparerEthnicityTitle,
applicantDemographicsPreparerRaceTitle,
),
diff --git a/src/applications/pre-need-integration/config/pages/applicantDemographics.jsx b/src/applications/pre-need-integration/config/pages/applicantDemographics.jsx
index a299bf854238..9f2c7f1ec386 100644
--- a/src/applications/pre-need-integration/config/pages/applicantDemographics.jsx
+++ b/src/applications/pre-need-integration/config/pages/applicantDemographics.jsx
@@ -13,12 +13,13 @@ import {
const { veteran } = fullSchemaPreNeed.properties.application.properties;
export function uiSchema(
+ subHeader = applicantDemographicsSubHeader,
genderTitle = applicantDemographicsGenderTitle,
maritalStatusTitle = applicantDemographicsMaritalStatusTitle,
) {
return {
application: {
- 'ui:title': applicantDemographicsSubHeader,
+ 'ui:title': subHeader,
'view:applicantDemographicsDescription': {
'ui:description': applicantDemographicsDescription,
'ui:options': {
diff --git a/src/applications/pre-need-integration/config/pages/applicantDemographics2.jsx b/src/applications/pre-need-integration/config/pages/applicantDemographics2.jsx
index cf9a3a9f3ac0..9629ed10fc35 100644
--- a/src/applications/pre-need-integration/config/pages/applicantDemographics2.jsx
+++ b/src/applications/pre-need-integration/config/pages/applicantDemographics2.jsx
@@ -13,12 +13,13 @@ import {
const { veteran } = fullSchemaPreNeed.properties.application.properties;
export function uiSchema(
+ subHeader = applicantDemographicsSubHeader,
ethnicityTitle = applicantDemographicsEthnicityTitle,
raceTitle = applicantDemographicsRaceTitle,
) {
return {
application: {
- 'ui:title': applicantDemographicsSubHeader,
+ 'ui:title': subHeader,
'view:applicantDemographicsDescription': {
'ui:description': applicantDemographicsDescription,
'ui:options': {
diff --git a/src/applications/pre-need-integration/config/pages/nonVeteranApplicantDetails.jsx b/src/applications/pre-need-integration/config/pages/nonVeteranApplicantDetails.jsx
index 375939d76133..ec355025bae3 100644
--- a/src/applications/pre-need-integration/config/pages/nonVeteranApplicantDetails.jsx
+++ b/src/applications/pre-need-integration/config/pages/nonVeteranApplicantDetails.jsx
@@ -5,87 +5,54 @@ import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/curren
import { merge, pick } from 'lodash';
-import environment from 'platform/utilities/environment';
-
import {
- applicantDetailsDescription,
- applicantDetailsSubHeader,
+ nonVeteranApplicantDetailsDescription,
+ nonVeteranApplicantDetailsSubHeader,
fullMaidenNameUI,
ssnDashesUI,
} from '../../utils/helpers';
const { claimant } = fullSchemaPreNeed.properties.application.properties;
-export const uiSchema = !environment.isProduction()
- ? {
- 'ui:description': applicantDescription,
- application: {
- 'ui:title': applicantDetailsSubHeader,
- claimant: {
- 'view:applicantDetailsDescription': {
- 'ui:description': applicantDetailsDescription,
- 'ui:options': {
- displayEmptyObjectOnReview: true,
- },
- },
- name: fullMaidenNameUI,
- ssn: ssnDashesUI,
- dateOfBirth: currentOrPastDateUI('Date of birth'),
- },
- },
- }
- : {
- 'ui:description': applicantDescription,
- application: {
- 'ui:title': applicantDetailsSubHeader,
- claimant: {
- name: fullMaidenNameUI,
- ssn: ssnDashesUI,
- dateOfBirth: currentOrPastDateUI('Date of birth'),
- },
- },
- };
-export const schema = !environment.isProduction()
- ? {
- type: 'object',
- properties: {
- application: {
- type: 'object',
- properties: {
- claimant: {
- type: 'object',
- required: ['name', 'ssn', 'dateOfBirth'],
- properties: merge(
- {},
- {
- 'view:applicantDetailsDescription': {
- type: 'object',
- properties: {},
- },
- },
- pick(claimant.properties, ['name', 'ssn', 'dateOfBirth']),
- ),
- },
- },
+export const uiSchema = {
+ 'ui:description': applicantDescription,
+ application: {
+ 'ui:title': nonVeteranApplicantDetailsSubHeader,
+ claimant: {
+ 'view:applicantDetailsDescription': {
+ 'ui:description': nonVeteranApplicantDetailsDescription,
+ 'ui:options': {
+ displayEmptyObjectOnReview: true,
},
},
- }
- : {
+ name: fullMaidenNameUI,
+ ssn: ssnDashesUI,
+ dateOfBirth: currentOrPastDateUI('Date of birth'),
+ },
+ },
+};
+
+export const schema = {
+ type: 'object',
+ properties: {
+ application: {
type: 'object',
properties: {
- application: {
+ claimant: {
type: 'object',
- properties: {
- claimant: {
- type: 'object',
- required: ['name', 'ssn', 'dateOfBirth'],
- properties: pick(claimant.properties, [
- 'name',
- 'ssn',
- 'dateOfBirth',
- ]),
+ required: ['name', 'ssn', 'dateOfBirth'],
+ properties: merge(
+ {},
+ {
+ 'view:applicantDetailsDescription': {
+ type: 'object',
+ properties: {},
+ },
},
- },
+ pick(claimant.properties, ['name', 'ssn', 'dateOfBirth']),
+ ),
},
},
- };
+ },
+ },
+};
diff --git a/src/applications/pre-need-integration/config/pages/sponsorRace.jsx b/src/applications/pre-need-integration/config/pages/sponsorRace.jsx
index 178303c1750e..b536ae62216e 100644
--- a/src/applications/pre-need-integration/config/pages/sponsorRace.jsx
+++ b/src/applications/pre-need-integration/config/pages/sponsorRace.jsx
@@ -19,8 +19,8 @@ export const uiSchema = {
},
},
veteran: merge({}, veteranUI, {
- ethnicity: { 'ui:title': 'What’s the sponsor’s marital status?' },
- race: { 'ui:title': 'What’s the sponsor’s sex?' },
+ ethnicity: { 'ui:title': 'What’s the sponsor’s ethnicity?' },
+ race: { 'ui:title': 'What’s the sponsor’s race?' },
}),
},
};
diff --git a/src/applications/pre-need-integration/config/pages/veteranApplicantDetails.jsx b/src/applications/pre-need-integration/config/pages/veteranApplicantDetails.jsx
index faac58a2cbec..b64fb32c04e8 100644
--- a/src/applications/pre-need-integration/config/pages/veteranApplicantDetails.jsx
+++ b/src/applications/pre-need-integration/config/pages/veteranApplicantDetails.jsx
@@ -1,13 +1,11 @@
import fullSchemaPreNeed from 'vets-json-schema/dist/40-10007-INTEGRATION-schema.json';
-import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
-
import { merge, pick } from 'lodash';
import {
- applicantDetailsDescription,
- applicantDetailsSubHeader,
- fullMaidenNameUI,
+ veteranApplicantDetailsSubHeader,
+ nonPreparerFullMaidenNameUI,
+ nonPreparerDateOfBirthUI,
ssnDashesUI,
// partial implementation of story resolving the address change:
// applicantDetailsCityTitle,
@@ -19,23 +17,29 @@ const {
veteran,
} = fullSchemaPreNeed.properties.application.properties;
-export function uiSchema() {
+export function uiSchema(
+ subHeader = veteranApplicantDetailsSubHeader,
+ description = '',
+ nameUI = nonPreparerFullMaidenNameUI,
+ ssnUI = ssnDashesUI,
+ dateOfBirthUI = nonPreparerDateOfBirthUI,
+) {
// partial implementation of story resolving the address change:
// cityTitle = applicantDetailsCityTitle,
// stateTitle = applicantDetailsStateTitle,
return {
application: {
- 'ui:title': applicantDetailsSubHeader,
+ 'ui:title': subHeader,
claimant: {
'view:applicantDetailsDescription': {
- 'ui:description': applicantDetailsDescription,
+ 'ui:description': description,
'ui:options': {
displayEmptyObjectOnReview: true,
},
},
- name: fullMaidenNameUI,
- ssn: ssnDashesUI,
- dateOfBirth: currentOrPastDateUI('Date of birth'),
+ name: nameUI,
+ ssn: ssnUI,
+ dateOfBirth: dateOfBirthUI,
},
veteran: {
placeOfBirth: {
diff --git a/src/applications/pre-need-integration/tests/config/veteranApplicantDetails.unit.spec.jsx b/src/applications/pre-need-integration/tests/config/veteranApplicantDetails.unit.spec.jsx
index 51a0dc8daa70..48681f13f93f 100644
--- a/src/applications/pre-need-integration/tests/config/veteranApplicantDetails.unit.spec.jsx
+++ b/src/applications/pre-need-integration/tests/config/veteranApplicantDetails.unit.spec.jsx
@@ -26,10 +26,6 @@ describe('Pre-need applicant veteran applicant details', () => {
expect(form.find('input').length).to.equal(7);
expect(form.find('select').length).to.equal(3);
- expect(form.find('va-additional-info').length).to.equal(1);
- expect(form.find('va-additional-info').html()).to.include(
- '
If you’re filling out the form on behalf of someone else, you’ll need to provide their details below. As the preparer, we’ll ask for your own details later.
',
- );
form.unmount();
});
diff --git a/src/applications/pre-need-integration/utils/helpers.js b/src/applications/pre-need-integration/utils/helpers.js
index ecb3a53c987f..9298fa3c4217 100644
--- a/src/applications/pre-need-integration/utils/helpers.js
+++ b/src/applications/pre-need-integration/utils/helpers.js
@@ -10,6 +10,7 @@ import fullNameUI from 'platform/forms/definitions/fullName';
import ssnUI from 'platform/forms-system/src/js/definitions/ssn';
import TextWidget from 'platform/forms-system/src/js/widgets/TextWidget';
import VaCheckboxGroupField from 'platform/forms-system/src/js/web-component-fields/VaCheckboxGroupField';
+import currentOrPastDateUI from 'platform/forms-system/src/js/definitions/currentOrPastDate';
import {
stringifyFormReplacer,
@@ -28,7 +29,19 @@ import CurrentlyBuriedDescription from '../components/CurrentlyBuriedDescription
export const nonRequiredFullNameUI = omit('required', fullNameUI);
-export const applicantDetailsSubHeader = (
+export const veteranApplicantDetailsSubHeader = (
+
- We require some basic details as part of your application. Please know we
- need to gather the data for statistical purposes.
+ We require demographic information as part of this application. We use
+ this information for statistical purposes only.
);
@@ -166,7 +185,10 @@ export const applicantInformationDescription = (
);
-export const applicantDetailsDescription = (
+export const veteranApplicantDetailsPreparerDescription =
+ 'Provide the details for the person you’re filling out the application for (called the applicant).';
+
+export const nonVeteranApplicantDetailsDescription = (
+ );
+}
diff --git a/src/applications/rated-disabilities/components/CombinedRating.jsx b/src/applications/rated-disabilities/components/CombinedRating.jsx
new file mode 100644
index 000000000000..dc4eeefaaab2
--- /dev/null
+++ b/src/applications/rated-disabilities/components/CombinedRating.jsx
@@ -0,0 +1,44 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
+
+import NoCombinedRating from './NoCombinedRating';
+
+const clickHandler = () => {
+ recordEvent({
+ event: 'disability-navigation-check-claims',
+ });
+};
+
+export default function CombinedRating({ combinedRating }) {
+ // It may be possible to have a combinedRating of 0,
+ // so not using !combinedRating here to avoid showing this
+ // component if combinedRating is 0
+ if (combinedRating === null || typeof combinedRating === 'undefined') {
+ return ;
+ }
+
+ const heading = `Your combined disability rating is ${combinedRating}%`;
+
+ return (
+
+
{heading}
+
+ This rating doesn’t include any conditions from claims that we’re still
+ reviewing. You can check the status of your disability claims, decision
+ reviews, or appeals online.
+
You can call us at .
- We’re We’re here Monday through Friday, 8:00 a.m to 9:00 p.m. ET. If
+ We’re here Monday through Friday, 8:00 a.m to 9:00 p.m. ET. If have
have hearing loss, call
diff --git a/src/applications/rated-disabilities/components/NoCombinedRating.jsx b/src/applications/rated-disabilities/components/NoCombinedRating.jsx
new file mode 100644
index 000000000000..a5827cd77bfc
--- /dev/null
+++ b/src/applications/rated-disabilities/components/NoCombinedRating.jsx
@@ -0,0 +1,22 @@
+import React from 'react';
+
+export default function NoCombinedRating() {
+ return (
+
+
+ We don’t have a combined disability rating on file for you
+
+
+
+ We can’t find a combined disability rating for you. If you have a
+ disability that was caused by or got worse because of your service,
+ you can file a claim for disability benefits.
+
+
+
+
+ );
+}
diff --git a/src/applications/rated-disabilities/components/RatingLists/List.jsx b/src/applications/rated-disabilities/components/RatingLists/List.jsx
new file mode 100644
index 000000000000..164cc3665ccc
--- /dev/null
+++ b/src/applications/rated-disabilities/components/RatingLists/List.jsx
@@ -0,0 +1,29 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import ListItem from './ListItem';
+
+export default function List({ ratings }) {
+ return (
+
+ We don’t have any rated disabilities on file for you
+
+
+
+ We can’t find any rated disabilities for you. If you have a disability
+ that was caused by or got worse because of your service, you can file
+ a claim for disability benefits.
+
Use this form if you plan to file a disability or pension claim. If
- you notify us of your intent to file, you may be able to get
- retroactive payments (payments for the time between when you submit
- your intent to file and when we approve your claim). An intent to file
- sets a potential start date (or effective date) for your benefits.
+ you notify us of your intent to file and we approve your claim, you
+ may be able to get retroactive payments. Retroactive payments are
+ payments for the time between when we processed your intent to file
+ and when we approved your claim. An intent to file sets a potential
+ start date (or effective date) for your benefits.
What to know before you fill out this form
+
+
+ After you submit your intent to file, you have{' '}
+ 1 year to complete and file your claim. After 1
+ year, the potential effective date for your benefits will expire.
+
+
+ In some cases, it may take us a few days to process your intent to
+ file after you submit it. We’ll let you know what your potential
+ effective date is after we process your intent to file.
+
+
+
What to know if you’re signing on behalf of someone else
+
+ We’ll need to have one of these forms showing that you’re authorized
+ to sign for the person filing the claim:
+
- After you submit your intent to file, you have 1 year to
- complete and file your claim. After 1 year, the potential effective
- date for your benefits will expire.
+ Note: If you’ve already submitted one of these forms,
+ you don’t need to do anything else. If you haven’t, submit one of
+ these forms before you submit an intent to file.
@@ -55,18 +93,18 @@ class IntroductionPage extends React.Component {
Claims you can file after filling out this form
- After you complete this form, we’ll direct you to the benefit
- application you need to complete.
+ After you complete this form, we’ll direct you to one or more of these
+ benefit applications for you to complete:
Disability compensation claim (VA Form 21-526EZ)
- . If you start your disability claim online now, you don’t need to
- fill out this intent to file form. When you start your disability
- application (or Supplemental Claim) online, it notifies us
- automatically of your intent to file.
+ . Note: If you start your disability claim online
+ now, you don’t need to fill out this intent to file form. When you
+ start your disability application or Supplemental Claim online, it
+ notifies us automatically of your intent to file.
- Do you have any of these conditions that were caused—or made
- worse—by your service?
-
- ),
- respiratoryIllness: {
- 'ui:title': 'A severe respiratory (breathing-related) illness',
- },
- blindness: {
- 'ui:title':
- 'Blindness in both eyes (with 20/200 visual acuity or less)',
- },
- lossOfHands: {
- 'ui:title': 'Loss or loss of use of both hands',
- },
- lossOfLimbs: {
- 'ui:title': 'Loss or loss of use of more than one limb',
- },
- lossOfLegs: {
- 'ui:title':
+ ...titleUI('Service-connected conditions'),
+ remarks: checkboxGroupUI({
+ title:
+ 'Do you have any of these conditions that were caused—or made worse—by your service?',
+ required: false,
+ labels: {
+ respiratoryIllness: 'A severe respiratory (breathing-related) illness',
+ blindness: 'Blindness in both eyes (with 20/200 visual acuity or less)',
+ lossOfHands: 'Loss or loss of use of both hands',
+ lossOfLimbs: 'Loss or loss of use of more than one limb',
+ lossOfLegs:
'Loss or loss of use of a lower leg along with the residuals (lasting effects) of an organic (natural) disease or injury',
- },
- lossOfExtremity: {
- 'ui:title':
+ lossOfExtremity:
'The loss, or loss of use, of one lower extremity (foot or leg) after September 11, 2001, which makes it so you can’t balance or walk without the help of braces, crutches, canes, or a wheelchair',
+ burns: 'Severe burns',
},
- burns: {
- 'ui:title': 'Severe burns',
- },
- otherConditions: {
- 'ui:title':
- 'If your conditions aren’t listed, you can write them here:',
- 'ui:widget': 'textarea',
- },
+ }),
+ otherConditions: {
+ 'ui:title': 'If your conditions aren’t listed, you can write them here:',
+ 'ui:webComponentField': VaTextAreaField,
},
'view:additionalInformation': {
'ui:description': (
-
+
,
+// status: externalServiceStatus.ok,
+// ...mockServiceProps,
+// };
+// const { getByText } = render();
+// getByText('Child content renders');
+// });
- it('renders content with vague time interval and no start/end time if no valid dates provided', () => {
- const mockServiceProps = {
- endTime: {},
- startTime: undefined,
- externalService: 'mhv_sm',
- };
- const mockProps = {
- status: externalServiceStatus.downtimeApproaching,
- ...mockServiceProps,
- };
+// it('renders content with vague time interval and no start/end time if no valid dates provided', () => {
+// const mockServiceProps = {
+// endTime: {},
+// startTime: undefined,
+// externalService: 'mhv_sm',
+// };
+// const mockProps = {
+// status: externalServiceStatus.downtimeApproaching,
+// ...mockServiceProps,
+// };
- const { getByText, queryByText } = render();
- getByText(/The maintenance will last some time/i);
- getByText(
- /During this time, you may have trouble using some of our health tools/i,
- );
- expect(queryByText('July 4, 2019 at 9:00 a.m. ET')).to.be.null;
- expect(queryByText('July 5, 2019 at 3:00 a.m. ET')).to.be.null;
- });
+// const { getByText, queryByText } = render();
+// getByText(/The maintenance will last some time/i);
+// getByText(
+// /During this time, you may have trouble using some of our health tools/i,
+// );
+// expect(queryByText('July 4, 2019 at 9:00 a.m. ET')).to.be.null;
+// expect(queryByText('July 5, 2019 at 3:00 a.m. ET')).to.be.null;
+// });
- it('renders content with vague time interval and start time if end time does not exist', () => {
- const mockServiceProps = {
- endTime: {},
- startTime: new Date('July 4, 2019 09:00:00 EDT'),
- externalService: 'mhv_sm',
- };
- const mockProps = {
- status: externalServiceStatus.downtimeApproaching,
- ...mockServiceProps,
- };
+// it('renders content with vague time interval and start time if end time does not exist', () => {
+// const mockServiceProps = {
+// endTime: {},
+// startTime: new Date('July 4, 2019 09:00:00 EDT'),
+// externalService: 'mhv_sm',
+// };
+// const mockProps = {
+// status: externalServiceStatus.downtimeApproaching,
+// ...mockServiceProps,
+// };
- const { getByText, queryByText } = render();
- getByText(/The maintenance will last some time/i);
- getByText(
- /During this time, you may have trouble using some of our health tools/i,
- );
- getByText('July 4, 2019 at 9:00 a.m. ET');
- expect(queryByText('July 5, 2019 at 3:00 a.m. ET')).to.be.null;
- });
+// const { getByText, queryByText } = render();
+// getByText(/The maintenance will last some time/i);
+// getByText(
+// /During this time, you may have trouble using some of our health tools/i,
+// );
+// getByText('July 4, 2019 at 9:00 a.m. ET');
+// expect(queryByText('July 5, 2019 at 3:00 a.m. ET')).to.be.null;
+// });
- it('renders content with vague time interval and end time if start time does not exist', () => {
- const mockServiceProps = {
- endTime: new Date('July 7, 2019 09:00:00 EDT'),
- startTime: { toDate: () => 'FAKE' },
- externalService: 'mhv_sm',
- };
- const mockProps = {
- status: externalServiceStatus.downtimeApproaching,
- ...mockServiceProps,
- };
+// it('renders content with vague time interval and end time if start time does not exist', () => {
+// const mockServiceProps = {
+// endTime: new Date('July 7, 2019 09:00:00 EDT'),
+// startTime: { toDate: () => 'FAKE' },
+// externalService: 'mhv_sm',
+// };
+// const mockProps = {
+// status: externalServiceStatus.downtimeApproaching,
+// ...mockServiceProps,
+// };
- const { getByText } = render();
- getByText(/The maintenance will last some time/i);
- getByText(
- /During this time, you may have trouble using some of our health tools/i,
- );
- getByText('July 7, 2019 at 9:00 a.m. ET');
- });
-});
+// const { getByText } = render();
+// getByText(/The maintenance will last some time/i);
+// getByText(
+// /During this time, you may have trouble using some of our health tools/i,
+// );
+// getByText('July 7, 2019 at 9:00 a.m. ET');
+// });
+// });
diff --git a/src/platform/mhv/downtime/tests/date.unit.spec.js b/src/platform/mhv/downtime/tests/date.unit.spec.js
index 038ba9b57863..7c487dcd70eb 100644
--- a/src/platform/mhv/downtime/tests/date.unit.spec.js
+++ b/src/platform/mhv/downtime/tests/date.unit.spec.js
@@ -1,129 +1,129 @@
-import { expect } from 'chai';
-// NOTE: moment is deprecated, should only be used for testing compatibility with older code
-import moment from 'moment';
-
-import {
- coerceToDate,
- formatDatetime,
- formatElapsedHours,
- parseDate,
-} from '../utils/date';
-
-describe('coerceToDate', () => {
- it('returns a Date instance when passed a moment object', () => {
- const m = moment('2024-02-14 09:30');
- const d = coerceToDate(m);
- expect(d).to.be.an.instanceOf(Date);
- });
-
- it('returns a date instance when passed a date instance', () => {
- const d1 = new Date();
- const d2 = coerceToDate(d1);
- expect(d2).to.equal(d1);
- });
-
- it('returns null when passed something that is not a date or moment object', () => {
- const x = '';
- const y = undefined;
- const z = {};
- // F is for Fake
- const f = { toDate: () => 'Tricked you!' };
-
- expect(coerceToDate(x)).to.be.null;
- expect(coerceToDate(y)).to.be.null;
- expect(coerceToDate(z)).to.be.null;
- expect(coerceToDate(f)).to.be.null;
- });
-});
-
-describe('parseDate', () => {
- it('parses an ISO 8601 date string', () => {
- const dateString = '2024-01-29T15:17:05-05:00';
-
- const result = parseDate(dateString);
-
- expect(result).to.respondTo('toISOString');
-
- expect(result.toISOString()).to.eql('2024-01-29T20:17:05.000Z');
- });
-
- it('returns null for invalid inputs', () => {
- expect(parseDate('foobar')).to.be.null;
- expect(parseDate(null)).to.be.null;
- expect(parseDate('Tomorrow')).to.be.null;
- });
-});
-
-describe('formatDatetime', () => {
- // Use times when UTC offset is -05:00, aka not daylight savings time
- it('formats a datetime string with long month name, full year and timezone abbreviation', () => {
- const dateString = '2024-01-01T15:17:05-05:00';
- const d = new Date(dateString);
-
- const result = formatDatetime(d);
-
- // Test must run in context of expected timezone
- expect(result).to.equal('January 1, 2024 at 3:17 p.m. ET');
- });
-
- it('formats 12:00 PM as noon', () => {
- const dateString = '2024-11-11T12:00-05:00';
- const d = new Date(dateString);
-
- const result = formatDatetime(d);
-
- // Test must run in context of expected timezone
- expect(result).to.equal('November 11, 2024 at noon ET');
- });
-
- it('formats 12:00 AM as midnight', () => {
- const dateString = '2024-11-12T00:00:00-05:00';
- const d = new Date(dateString);
-
- const result = formatDatetime(d);
-
- // Test must run in context of expected timezone
- expect(result).to.equal('November 12, 2024 at midnight ET');
- });
-
- it('handles datetimes in daylight savings appropriately', () => {
- // DST in 2024 is March 10, 2024 - November 03, 2024
- // Use April 1, 2024, 10am to be in DST
- const dateString = '2024-04-01T10:00:00-04:00';
- const d = new Date(dateString);
-
- const result = formatDatetime(d);
-
- // Test must run in context of expected timezone
- expect(result).to.equal('April 1, 2024 at 10:00 a.m. ET');
- });
-});
-
-describe('formatElapsedHours', () => {
- it('shows 1 hour when time difference is less than an hour and a half', () => {
- const startDate = new Date(2024, 2, 14, 14);
- const endDate = new Date(2024, 2, 14, 15, 15);
-
- const result = formatElapsedHours(startDate, endDate);
+// import { expect } from 'chai';
+// // NOTE: moment is deprecated, should only be used for testing compatibility with older code
+// import moment from 'moment';
+
+// import {
+// coerceToDate,
+// formatDatetime,
+// formatElapsedHours,
+// parseDate,
+// } from '../utils/date';
+
+// describe('coerceToDate', () => {
+// it('returns a Date instance when passed a moment object', () => {
+// const m = moment('2024-02-14 09:30');
+// const d = coerceToDate(m);
+// expect(d).to.be.an.instanceOf(Date);
+// });
+
+// it('returns a date instance when passed a date instance', () => {
+// const d1 = new Date();
+// const d2 = coerceToDate(d1);
+// expect(d2).to.equal(d1);
+// });
+
+// it('returns null when passed something that is not a date or moment object', () => {
+// const x = '';
+// const y = undefined;
+// const z = {};
+// // F is for Fake
+// const f = { toDate: () => 'Tricked you!' };
+
+// expect(coerceToDate(x)).to.be.null;
+// expect(coerceToDate(y)).to.be.null;
+// expect(coerceToDate(z)).to.be.null;
+// expect(coerceToDate(f)).to.be.null;
+// });
+// });
+
+// describe('parseDate', () => {
+// it('parses an ISO 8601 date string', () => {
+// const dateString = '2024-01-29T15:17:05-05:00';
+
+// const result = parseDate(dateString);
+
+// expect(result).to.respondTo('toISOString');
+
+// expect(result.toISOString()).to.eql('2024-01-29T20:17:05.000Z');
+// });
+
+// it('returns null for invalid inputs', () => {
+// expect(parseDate('foobar')).to.be.null;
+// expect(parseDate(null)).to.be.null;
+// expect(parseDate('Tomorrow')).to.be.null;
+// });
+// });
+
+// describe('formatDatetime', () => {
+// // Use times when UTC offset is -05:00, aka not daylight savings time
+// it('formats a datetime string with long month name, full year and timezone abbreviation', () => {
+// const dateString = '2024-01-01T15:17:05-05:00';
+// const d = new Date(dateString);
+
+// const result = formatDatetime(d);
+
+// // Test must run in context of expected timezone
+// expect(result).to.equal('January 1, 2024 at 3:17 p.m. ET');
+// });
+
+// it('formats 12:00 PM as noon', () => {
+// const dateString = '2024-11-11T12:00-05:00';
+// const d = new Date(dateString);
+
+// const result = formatDatetime(d);
+
+// // Test must run in context of expected timezone
+// expect(result).to.equal('November 11, 2024 at noon ET');
+// });
+
+// it('formats 12:00 AM as midnight', () => {
+// const dateString = '2024-11-12T00:00:00-05:00';
+// const d = new Date(dateString);
+
+// const result = formatDatetime(d);
+
+// // Test must run in context of expected timezone
+// expect(result).to.equal('November 12, 2024 at midnight ET');
+// });
+
+// it('handles datetimes in daylight savings appropriately', () => {
+// // DST in 2024 is March 10, 2024 - November 03, 2024
+// // Use April 1, 2024, 10am to be in DST
+// const dateString = '2024-04-01T10:00:00-04:00';
+// const d = new Date(dateString);
+
+// const result = formatDatetime(d);
+
+// // Test must run in context of expected timezone
+// expect(result).to.equal('April 1, 2024 at 10:00 a.m. ET');
+// });
+// });
+
+// describe('formatElapsedHours', () => {
+// it('shows 1 hour when time difference is less than an hour and a half', () => {
+// const startDate = new Date(2024, 2, 14, 14);
+// const endDate = new Date(2024, 2, 14, 15, 15);
+
+// const result = formatElapsedHours(startDate, endDate);
- expect(result).to.equal('1 hour');
- });
+// expect(result).to.equal('1 hour');
+// });
- it('shows a plural hours when time difference is greater than an hour and a half', () => {
- const startDate = new Date(2024, 2, 14, 14);
- const endDate = new Date(2024, 2, 14, 18, 30);
+// it('shows a plural hours when time difference is greater than an hour and a half', () => {
+// const startDate = new Date(2024, 2, 14, 14);
+// const endDate = new Date(2024, 2, 14, 18, 30);
- const result = formatElapsedHours(startDate, endDate);
+// const result = formatElapsedHours(startDate, endDate);
- expect(result).to.equal('5 hours');
- });
+// expect(result).to.equal('5 hours');
+// });
- it('returns null when start or end time is not or cannot be coerced to a date', () => {
- expect(formatElapsedHours('foo', new Date())).to.be.null;
+// it('returns null when start or end time is not or cannot be coerced to a date', () => {
+// expect(formatElapsedHours('foo', new Date())).to.be.null;
- expect(formatElapsedHours(new Date(), { toDate: () => "It's a trap!" })).to
- .be.null;
+// expect(formatElapsedHours(new Date(), { toDate: () => "It's a trap!" })).to
+// .be.null;
- expect(formatElapsedHours(undefined, null)).to.be.null;
- });
-});
+// expect(formatElapsedHours(undefined, null)).to.be.null;
+// });
+// });
diff --git a/src/platform/testing/unit/mocha-setup.js b/src/platform/testing/unit/mocha-setup.js
index 82ac5d5a584b..381a2d7d1d70 100644
--- a/src/platform/testing/unit/mocha-setup.js
+++ b/src/platform/testing/unit/mocha-setup.js
@@ -166,6 +166,10 @@ const cleanupStorage = () => {
sessionStorage.clear();
};
+function flushPromises() {
+ return new Promise(resolve => setImmediate(resolve));
+}
+
export const mochaHooks = {
beforeEach() {
setupJSDom();
@@ -181,5 +185,6 @@ export const mochaHooks = {
},
afterEach() {
cleanupStorage();
+ flushPromises();
},
};
diff --git a/src/platform/testing/unit/mocha.opts b/src/platform/testing/unit/mocha.opts
index 79ab15cb8e8f..6b6321d944eb 100644
--- a/src/platform/testing/unit/mocha.opts
+++ b/src/platform/testing/unit/mocha.opts
@@ -1,6 +1,5 @@
--require src/platform/testing/unit/mocha-setup.js
--require src/platform/testing/unit/enzyme-setup.js
---require choma
--require core-js/stable
--require regenerator-runtime/runtime
--require blob-polyfill
diff --git a/src/platform/testing/unit/schemaform-utils.jsx b/src/platform/testing/unit/schemaform-utils.jsx
index 8f8c44e12394..5454b75f357e 100644
--- a/src/platform/testing/unit/schemaform-utils.jsx
+++ b/src/platform/testing/unit/schemaform-utils.jsx
@@ -49,6 +49,8 @@ function getDefaultData(schema) {
* @property {function} updateFormData Will be called if form is updated
*/
export class DefinitionTester extends React.Component {
+ debouncedAutoSave = sinon.spy();
+
constructor(props) {
super(props);
const { data, uiSchema } = props;
@@ -58,21 +60,19 @@ export class DefinitionTester extends React.Component {
};
const schema = replaceRefSchemas(props.schema, definitions);
- const { data: newData, schema: newSchema } = updateSchemasAndData(
- schema,
- uiSchema,
- data || getDefaultData(schema),
- );
+ const {
+ data: newData,
+ schema: newSchema,
+ uiSchema: newUiSchema,
+ } = updateSchemasAndData(schema, uiSchema, data || getDefaultData(schema));
this.state = {
formData: newData,
schema: newSchema,
- uiSchema,
+ uiSchema: newUiSchema,
};
}
- debouncedAutoSave = sinon.spy();
-
handleChange = data => {
const { schema, uiSchema, formData } = this.state;
const { pagePerItemIndex, arrayPath, updateFormData } = this.props;
@@ -87,6 +87,7 @@ export class DefinitionTester extends React.Component {
let newData = newSchemaAndData.data;
const newSchema = newSchemaAndData.schema;
+ const newUiSchema = newSchemaAndData.uiSchema;
if (typeof updateFormData === 'function') {
if (arrayPath && typeof pagePerItemIndex === 'undefined') {
@@ -106,7 +107,7 @@ export class DefinitionTester extends React.Component {
this.setState({
formData: newData,
schema: newSchema,
- uiSchema,
+ uiSchema: newUiSchema,
});
};
diff --git a/src/platform/user/authorization/components/IdentityNotVerified.jsx b/src/platform/user/authorization/components/IdentityNotVerified.jsx
index c7b5f125137f..9d0a79c7e79b 100644
--- a/src/platform/user/authorization/components/IdentityNotVerified.jsx
+++ b/src/platform/user/authorization/components/IdentityNotVerified.jsx
@@ -4,7 +4,7 @@ import { AUTH_EVENTS } from '@department-of-veterans-affairs/platform-user/authe
import PropTypes from 'prop-types';
import recordEvent from '~/platform/monitoring/record-event';
-const HowToVerifyLink = () => (
+export const HowToVerifyLink = () => (