Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes vaOnlineSchedulingStatusImprovement from ScheduleNewAppointment component #28048

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -4,11 +4,7 @@
import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
import { GA_PREFIX } from 'applications/vaos/utils/constants';
import { startNewAppointmentFlow } from '../redux/actions';
import {
selectFeatureRequests,
selectFeatureStatusImprovement,
selectFeatureStartSchedulingLink,
} from '../../redux/selectors';
import { selectFeatureStartSchedulingLink } from '../../redux/selectors';
// eslint-disable-next-line import/no-restricted-paths
import getNewAppointmentFlow from '../../new-appointment/newAppointmentFlow';

Expand Down Expand Up @@ -55,7 +51,7 @@
Start scheduling
</a>
) : (
<button

Check warning on line 54 in src/applications/vaos/appointment-list/components/ScheduleNewAppointment.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/appointment-list/components/ScheduleNewAppointment.jsx:54:5:The <va-button> Web Component should be used instead of the button HTML element.
type="button"
className="xsmall-screen:vads-u-margin-bottom--3 vaos-hide-for-print vads-u-margin--0 small-screen:vads-u-margin-bottom--4"
aria-label="Start scheduling an appointment"
Expand All @@ -68,44 +64,14 @@
}

export default function ScheduleNewAppointment() {
const history = useHistory();
const dispatch = useDispatch();
const location = useLocation();
const featureStatusImprovement = useSelector(state =>
selectFeatureStatusImprovement(state),
);
const showScheduleButton = useSelector(state => selectFeatureRequests(state));
const { typeOfCare } = useSelector(getNewAppointmentFlow);

if (featureStatusImprovement) {
// Only display scheduling button on upcoming appointments page
if (
location.pathname.endsWith('pending') ||
location.pathname.endsWith('past')
) {
return null;
}
return <ScheduleNewAppointmentButton />;
// Only display scheduling button on upcoming appointments page
if (
location.pathname.endsWith('pending') ||
location.pathname.endsWith('past')
) {
return null;
}

return (
<>
{!featureStatusImprovement &&
showScheduleButton && (
<div className="vads-u-margin-bottom--1p5 vaos-hide-for-print">
Schedule primary or specialty care appointments.
</div>
)}

<button
type="button"
className="vaos-hide-for-print"
aria-label="Start scheduling an appointment"
id="schedule-button"
onClick={handleClick(history, dispatch, typeOfCare)}
>
Start scheduling
</button>
</>
);
return <ScheduleNewAppointmentButton />;
}
Expand Up @@ -4,7 +4,7 @@
import moment from 'moment';
import { waitFor, within } from '@testing-library/dom';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import { mockFetch, setFetchJSONResponse } from 'platform/testing/unit/helpers';

Check warning on line 7 in src/applications/vaos/tests/appointment-list/components/AppointmentsPageV2/index.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/tests/appointment-list/components/AppointmentsPageV2/index.unit.spec.js:7:1:Importing from platform via platform/testing is deprecated. Import from @department-of-veterans-affairs/platform-testing instead or check babel.config.json for an alias to the import.
import userEvent from '@testing-library/user-event';
import {
createTestStore,
Expand Down Expand Up @@ -86,8 +86,7 @@
},
});

expect(screen.getByText(/Schedule primary or specialty care appointments./))
.to.be.ok;
expect(screen.getByText(/Start scheduling/)).to.be.ok;
userEvent.click(
await screen.findByRole('button', { name: /Start scheduling/i }),
);
Expand Down
Expand Up @@ -5,7 +5,10 @@ import { mockFetch } from '@department-of-veterans-affairs/platform-testing/help
import userEvent from '@testing-library/user-event';
import sinon from 'sinon';
import { fireEvent, waitFor } from '@testing-library/react';
import { APPOINTMENT_STATUS } from '../../../../utils/constants';
import {
APPOINTMENT_STATUS,
TYPE_OF_VISIT_ID,
} from '../../../../utils/constants';
import { renderWithStoreAndRouter, getTestDate } from '../../../mocks/setup';

import { AppointmentList } from '../../../../appointment-list';
Expand Down Expand Up @@ -66,7 +69,6 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
});
mockFacilityFetchByVersion({ facility: facilityResponse });

// Act
// Act
const screen = renderWithStoreAndRouter(<AppointmentList />, {
initialState,
Expand Down Expand Up @@ -122,66 +124,36 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
});

it('should show confirmed phone appointments detail page', async () => {
// Given a booked phone appointment
const myInitialState = {
...initialState,
featureToggles: {
...initialState.featureToggles,
vaOnlineSchedulingVAOSServiceVAAppointments: true,
},
};
// When fetching the specific appointment id
const url = '/va/1234';
const futureDate = moment(getTestDate());

const appointment = getVAOSAppointmentMock();
appointment.id = '1234';
appointment.attributes = {
...appointment.attributes,
kind: 'phone',
clinic: '455',
// Arrange
const response = new MockAppointmentResponse({
kind: TYPE_OF_VISIT_ID.phone,
});
response
.setLocationId('983GC')
.setClinicId('455')
.setReasonCode({ text: 'I have a headache' });
const clinicResponse = new MockClinicResponse({
id: 455,
locationId: '983GC',
id: '1234',
preferredTimesForPhoneCall: ['Morning'],
reasonCode: {
coding: [{ code: 'New Problem' }],
text: 'I have a headache',
},
comment: 'New issue: I have a headache',
serviceType: 'primaryCare',
localStartTime: futureDate.format('YYYY-MM-DDTHH:mm:ss.000ZZ'),
start: futureDate.add(1, 'days').format(),
status: 'booked',
cancellable: true,
};
name: 'Some fancy clinic name',
});
const facilityResponse = new MockFacilityResponse({ id: '983GC' });

mockSingleClinicFetchByVersion({
mockAppointmentApi({ response });
mockClinicsApi({
clinicId: '455',
locationId: '983GC',
clinicName: 'Some fancy clinic name',
version: 2,
});
mockSingleVAOSAppointmentFetch({ appointment });

mockFacilityFetchByVersion({
facility: createMockFacilityByVersion({
id: '983GC',
name: 'Cheyenne VA Medical Center',
phone: '970-224-1550',
address: {
postalCode: '82001-5356',
city: 'Cheyenne',
state: 'WY',
line: ['2360 East Pershing Boulevard'],
},
}),
response: [clinicResponse],
});
mockFacilityFetchByVersion({ facility: facilityResponse });

// Act
const screen = renderWithStoreAndRouter(<AppointmentList />, {
initialState: myInitialState,
path: url,
initialState,
path: `/va/${response.id}`,
});

// Assert
// Verify document title and content...
await waitFor(() => {
expect(document.activeElement).to.have.tagName('h1');
Expand All @@ -191,7 +163,9 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
screen.getByRole('heading', {
level: 1,
name: new RegExp(
futureDate.tz('America/Denver').format('dddd, MMMM D, YYYY'),
moment()
.tz('America/Denver')
.format('dddd, MMMM D, YYYY'),
'i',
),
}),
Expand Down Expand Up @@ -222,11 +196,11 @@ describe('VAOS Page: ConfirmedAppointmentDetailsPage with VAOS service', () => {
name: 'You shared these details about your concern',
}),
).to.be.ok;
expect(screen.getByText(/New medical issue: I have a headache/)).to.be.ok;
expect(screen.getByText(/I have a headache/)).to.be.ok;
expect(
screen.getByTestId('add-to-calendar-link', {
name: new RegExp(
futureDate
moment()
.tz('America/Denver')
.format('[Add] MMMM D, YYYY [appointment to your calendar]'),
'i',
Expand Down