Skip to content

Commit

Permalink
Update alert for no recent visit in the request flow (#33424)
Browse files Browse the repository at this point in the history
* Update alert for request flow noPastVisit

* fix unit test
  • Loading branch information
jenniemc authored Dec 10, 2024
1 parent 4dcaeb5 commit 33e3b87
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('VAOS Page: VAFacilityPage eligibility check', () => {
screen.queryByText(/San Diego VA Medical Center/i);
});
await screen.findByText(
/you need to have had a mental health appointment at this facility within the last 12 months/,
/You haven’t had a recent appointment at this facility/i,
);
});

Expand Down Expand Up @@ -679,14 +679,15 @@ describe('VAOS Page: VAFacilityPage eligibility check', () => {
fireEvent.click(screen.getByText(/Continue/));
await screen.findByTestId('eligibilityModal');
expect(screen.getByRole('alertdialog')).to.be.ok;
expect(screen.baseElement).to.contain.text('last 36 months');
fireEvent.click(screen.getByRole('button', { name: /Continue/i }));

await waitFor(
() =>
expect(
screen.queryByText(/We can’t find a recent appointment for you/i),
).to.not.exist,
screen.queryByText(
/You haven’t had a recent appointment at this facility/i,
),
).to.exist,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@ import PropTypes from 'prop-types';
import React from 'react';
import { VaTelephone } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import FacilityAddress from '../../../components/FacilityAddress';
import NewTabAnchor from '../../../components/NewTabAnchor';
import { ELIGIBILITY_REASONS } from '../../../utils/constants';
import { aOrAn, lowerCase } from '../../../utils/formatters';

export default function getEligibilityMessage({
typeOfCare,
eligibility,
facilityDetails,
includeFacilityContactInfo = false,
}) {
let content = null;
let title = null;
const settings = facilityDetails?.legacyVAR?.settings?.[typeOfCare.id];

const requestReason = eligibility.requestReasons[0];
const directReason = eligibility.directReasons[0];

if (
requestReason === ELIGIBILITY_REASONS.notSupported &&
directReason === ELIGIBILITY_REASONS.noRecentVisit
(requestReason === ELIGIBILITY_REASONS.notSupported &&
directReason === ELIGIBILITY_REASONS.noRecentVisit) ||
requestReason === ELIGIBILITY_REASONS.noRecentVisit
) {
title = 'You can’t schedule an appointment online at this facility';
const contact = facilityDetails?.telecom?.find(
Expand Down Expand Up @@ -88,23 +85,6 @@ export default function getEligibilityMessage({
of care.
</>
);
} else if (requestReason === ELIGIBILITY_REASONS.noRecentVisit) {
const monthRequirement = settings?.request?.patientHistoryDuration
? (settings.request.patientHistoryDuration / 365) * 12
: '24';
title = 'We can’t find a recent appointment for you';
content = (
<>
To request an appointment online at this location, you need to have had{' '}
{aOrAn(typeOfCare?.name)} {lowerCase(typeOfCare?.name)} appointment at
this facility within the last {monthRequirement} months. Please call
this facility to schedule your appointment or{' '}
<NewTabAnchor href="/find-locations">
search for another VA facility
</NewTabAnchor>
.
</>
);
} else if (requestReason === ELIGIBILITY_REASONS.overRequestLimit) {
title = 'You’ve reached the limit for appointment requests';
content = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ describe('VAOS direct schedule flow - Multiple facilities dead ends', () => {
.selectLocation(/Facility 983/i)
.clickNextButton()
.assertWarningModal({
text: /We can’t find a recent appointment for you/i,
text: /You haven’t had a recent appointment at this facility/i,
});

// Assert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('VAOS direct schedule flow - Single clinic dead ends', () => {
text: /You can.t schedule this appointment online/i,
})
.assertText({
text: /To request an appointment online at this location, you need to have had a primary care appointment at this facility within the last 24 months/i,
text: /You haven’t had a recent appointment at this facility/i,
})
.assertButton({ exist: false, label: /Continue/i });

Expand Down

0 comments on commit 33e3b87

Please sign in to comment.