Skip to content

Commit

Permalink
Removes My VA Health from VAOS direct schedule facility page (#33516)
Browse files Browse the repository at this point in the history
* Removes My VA Health schedule links from VA facility page

* Removes unused tests
  • Loading branch information
ryanshaw authored and Khoa-V-Nguyen committed Dec 16, 2024
1 parent 3de14b4 commit 16ba933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 158 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { shallowEqual, useSelector } from 'react-redux';
import { getCernerURL } from 'platform/utilities/cerner';
import { VaSelect } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import { selectFacilitiesRadioWidget } from '../../redux/selectors';
import State from '../../../components/State';
import InfoAlert from '../../../components/InfoAlert';
import { FACILITY_SORT_METHODS, FETCH_STATUS } from '../../../utils/constants';
import { scrollAndFocus } from '../../../utils/scrollAndFocus';
import { isCernerLocation } from '../../../services/location';
import NoAddressNote from '../NoAddressNote';
import { useOHDirectScheduling } from '../../hooks/useOHDirectScheduling';
import { useOHRequestScheduling } from '../../hooks/useOHRequestScheduling';

const INITIAL_FACILITY_DISPLAY_COUNT = 5;
/*
Expand All @@ -26,12 +22,10 @@ export default function FacilitiesRadioWidget({
onChange,
formContext,
}) {
const {
cernerSiteIds,
requestLocationStatus,
sortMethod,
loadingEligibility,
} = useSelector(state => selectFacilitiesRadioWidget(state), shallowEqual);
const { requestLocationStatus, sortMethod, loadingEligibility } = useSelector(
state => selectFacilitiesRadioWidget(state),
shallowEqual,
);

const { hasUserAddress, sortOptions, updateFacilitySortMethod } = formContext;
const { enumOptions } = options;
Expand Down Expand Up @@ -67,9 +61,6 @@ export default function FacilitiesRadioWidget({
);
});

const useOHDirectSchedule = useOHDirectScheduling();
const useOHRequestSchedule = useOHRequestScheduling();

useEffect(
() => {
if (displayedOptions.length > INITIAL_FACILITY_DISPLAY_COUNT) {
Expand Down Expand Up @@ -128,7 +119,6 @@ export default function FacilitiesRadioWidget({
displayedOptions.map((option, i) => {
const { name, address, legacyVAR } = option?.label;
const checked = option.value === value;
const isCerner = isCernerLocation(option.value, cernerSiteIds);
let distance;

if (sortMethod === FACILITY_SORT_METHODS.distanceFromResidential) {
Expand Down Expand Up @@ -165,12 +155,6 @@ export default function FacilitiesRadioWidget({
{distance} miles
</span>
)}
{isCerner &&
(!useOHDirectSchedule && !useOHRequestSchedule) && (
<a href={getCernerURL('/pages/scheduling/upcoming')}>
Schedule online at <strong>My VA Health</strong>
</a>
)}
</label>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { expect } from 'chai';

// eslint-disable-next-line import/no-unresolved
import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';
import { fireEvent, waitFor, within } from '@testing-library/dom';
import { fireEvent, waitFor } from '@testing-library/dom';
import { cleanup } from '@testing-library/react';
import VAFacilityPage from './VAFacilityPageV2';
import {
Expand Down Expand Up @@ -1317,16 +1317,6 @@ describe('VAOS Page: VAFacilityPage', () => {
expect(await screen.findByText(/First Cerner facility/i)).to.be.ok;
expect(screen.getByText(/Second Cerner facility/i)).to.be.ok;

// Make sure Cerner link shows up
const cernerSiteLabel = document.querySelector(
`label[for="${screen.getByLabelText(/First Cerner facility/i).id}"]`,
);
expect(
within(cernerSiteLabel)
.getByRole('link', { name: /My VA Health/ })
.getAttribute('href'),
).to.contain('pages/scheduling/upcoming');

// Make sure Cerner facilities show up only once
expect(screen.getAllByText(/Second Cerner facility/i)).to.have.length(1);
userEvent.click(screen.getByLabelText(/First cerner facility/i));
Expand All @@ -1338,131 +1328,4 @@ describe('VAOS Page: VAFacilityPage', () => {
);
});
});

describe('when OH Direct Scheduling is enabled', () => {
beforeEach(() => mockFetch());

const initialState = {
drupalStaticData: {
vamcEhrData: {
loading: false,
data: {
ehrDataByVhaId: {
'442': {
vhaId: '442',
vamcFacilityName: 'Cheyenne VA Medical Center',
vamcSystemName: 'VA Cheyenne health care',
ehr: 'cerner',
},
'552': {
vhaId: '552',
vamcFacilityName: 'Dayton VA Medical Center',
vamcSystemName: 'VA Dayton health care',
ehr: 'cerner',
},
},
cernerFacilities: [
{
vhaId: '442',
vamcFacilityName: 'Cheyenne VA Medical Center',
vamcSystemName: 'VA Cheyenne health care',
ehr: 'cerner',
},
{
vhaId: '552',
vamcFacilityName: 'Dayton VA Medical Center',
vamcSystemName: 'VA Dayton health care',
ehr: 'cerner',
},
],
vistaFacilities: [],
},
},
},
featureToggles: {
vaOnlineSchedulingDirect: true,
vaOnlineSchedulingUseDsot: true,
vaOnlineSchedulingOhDirectSchedule: true,
},
user: {
profile: {
facilities: [
{
facilityId: '442', // Must use real facility id when using DSOT
isCerner: false, // Not used when using DSOT
},
{ facilityId: '552', isCerner: false },
],
},
},
};

it('should not display MHV scheduling link for foodAndNutrition appointments', async () => {
mockFacilitiesFetch({
children: true,
facilities: [
createMockFacility({
id: '983',
name: 'First cerner facility',
lat: 39.1362562,
long: -83.1804804,
}),
createMockFacility({
id: '984',
name: 'Second Cerner facility',
lat: 39.1362562,
long: -83.1804804,
}),
],
});

mockSchedulingConfigurations([
getSchedulingConfigurationMock({
id: '983',
typeOfCareId: 'foodAndNutrition',
directEnabled: true,
}),
getSchedulingConfigurationMock({
id: '984',
typeOfCareId: 'foodAndNutrition',
directEnabled: true,
}),
]);

const store = createTestStore({
...initialState,
user: {
...initialState.user,
profile: {
...initialState.user.profile,
vapContactInfo: {
residentialAddress: {
latitude: 39.1362562,
longitude: -84.6804804,
},
},
},
},
});

await setTypeOfCare(store, /nutrition and food/i);

const screen = renderWithStoreAndRouter(<VAFacilityPage />, {
store,
});

// Make sure Cerner facilities show up
expect(await screen.findByText(/First Cerner facility/i)).to.be.ok;
expect(await screen.getByText(/Second Cerner facility/i)).to.be.ok;

// Make sure Cerner link does not show up for foodAndNutrition
const cernerSiteLabel = document.querySelector(
`label[for="${screen.getByLabelText(/First Cerner facility/i).id}"]`,
);

expect(
within(cernerSiteLabel).queryByRole('link', { name: /My VA Health/ }),
).not.to.exist;
});
});
});

0 comments on commit 16ba933

Please sign in to comment.