diff --git a/src/applications/vaos/appointment-list/components/AppointmentsPage/index.jsx b/src/applications/vaos/appointment-list/components/AppointmentsPage/index.jsx
index 598e6ba90b8d..a963bf7df6e1 100644
--- a/src/applications/vaos/appointment-list/components/AppointmentsPage/index.jsx
+++ b/src/applications/vaos/appointment-list/components/AppointmentsPage/index.jsx
@@ -12,7 +12,6 @@ import {
} from '../../../redux/selectors';
import UpcomingAppointmentsList from '../UpcomingAppointmentsList';
import PastAppointmentsList from '../PastAppointmentsList';
-import CanceledAppointmentsList from '../CanceledAppointmentsList';
import WarningNotification from '../../../components/WarningNotification';
import ScheduleNewAppointment from '../ScheduleNewAppointment';
import PageLayout from '../PageLayout';
@@ -28,32 +27,6 @@ import CernerAlert from '../../../components/CernerAlert';
// import CernerTransitionAlert from '../../../components/CernerTransitionAlert';
// import { selectPatientFacilities } from '~/platform/user/cerner-dsot/selectors';
-const SUBPAGE_TITLES = {
- upcoming: 'Your appointments',
- requested: 'Requested',
- past: 'Past appointments',
- canceled: 'Canceled appointments',
-};
-
-function getSubPageTitleFromLocation(pathname) {
- if (pathname.endsWith(SUBPAGE_TITLES.requested)) {
- return SUBPAGE_TITLES.requested;
- }
-
- if (pathname.endsWith(SUBPAGE_TITLES.past)) {
- return SUBPAGE_TITLES.past;
- }
- if (pathname.endsWith(SUBPAGE_TITLES.canceled)) {
- return SUBPAGE_TITLES.canceled;
- }
-
- if (pathname.endsWith(SUBPAGE_TITLES.requested)) {
- return SUBPAGE_TITLES.requested;
- }
-
- return SUBPAGE_TITLES.upcoming;
-}
-
function renderWarningNotification() {
return (props, childContent) => {
const { status, description } = props;
@@ -84,8 +57,6 @@ export default function AppointmentsPage() {
// selectFeatureBookingExclusion(state),
// );
- const subPageTitle = getSubPageTitleFromLocation(location.pathname);
-
let prefix = 'Your';
const isPending = location.pathname.endsWith('/pending');
const isPast = location.pathname.endsWith('/past');
@@ -125,13 +96,7 @@ export default function AppointmentsPage() {
scrollAndFocus('h1');
}
},
- [
- subPageTitle,
- location.pathname,
- prefix,
- pageTitle,
- featureBreadcrumbUrlUpdate,
- ],
+ [location.pathname, prefix, pageTitle, featureBreadcrumbUrlUpdate],
);
const [count, setCount] = useState(0);
@@ -190,9 +155,6 @@ export default function AppointmentsPage() {
-
-
-
);
diff --git a/src/applications/vaos/appointment-list/components/CanceledAppointmentsList.jsx b/src/applications/vaos/appointment-list/components/CanceledAppointmentsList.jsx
deleted file mode 100644
index bd7e7c03349a..000000000000
--- a/src/applications/vaos/appointment-list/components/CanceledAppointmentsList.jsx
+++ /dev/null
@@ -1,188 +0,0 @@
-import React, { useEffect } from 'react';
-import { shallowEqual, useDispatch, useSelector } from 'react-redux';
-
-import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
-import moment from 'moment';
-import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
-import PropTypes from 'prop-types';
-import { useHistory } from 'react-router-dom';
-import {
- fetchFutureAppointments,
- startNewAppointmentFlow,
-} from '../redux/actions';
-import { getCanceledAppointmentListInfo } from '../redux/selectors';
-import {
- FETCH_STATUS,
- GA_PREFIX,
- APPOINTMENT_TYPES,
- SPACE_BAR,
-} from '../../utils/constants';
-import {
- getLink,
- getVAAppointmentLocationId,
-} from '../../services/appointment';
-import AppointmentListItem from './AppointmentsPage/AppointmentListItem';
-import NoAppointments from './NoAppointments';
-import InfoAlert from '../../components/InfoAlert';
-import { scrollAndFocus } from '../../utils/scrollAndFocus';
-import AppointmentCard from './AppointmentsPage/AppointmentCard';
-import { selectFeatureBreadcrumbUrlUpdate } from '../../redux/selectors';
-
-function handleClick({ history, link, idClickable }) {
- return () => {
- if (!window.getSelection().toString()) {
- focusElement(`#${idClickable}`);
- history.push(link);
- }
- };
-}
-
-function handleKeyDown({ history, link, idClickable }) {
- return event => {
- if (!window.getSelection().toString() && event.keyCode === SPACE_BAR) {
- focusElement(`#${idClickable}`);
- history.push(link);
- }
- };
-}
-
-export default function CanceledAppointmentsList({ hasTypeChanged }) {
- const history = useHistory();
- const dispatch = useDispatch();
- const {
- appointmentsByMonth,
- facilityData,
- futureStatus,
- showScheduleButton,
- } = useSelector(state => getCanceledAppointmentListInfo(state), shallowEqual);
- const featureBreadcrumbUrlUpdate = useSelector(state =>
- selectFeatureBreadcrumbUrlUpdate(state),
- );
-
- useEffect(
- () => {
- if (futureStatus === FETCH_STATUS.notStarted) {
- dispatch(fetchFutureAppointments({ includeRequests: true }));
- } else if (hasTypeChanged && futureStatus === FETCH_STATUS.succeeded) {
- scrollAndFocus('#type-dropdown');
- } else if (hasTypeChanged && futureStatus === FETCH_STATUS.failed) {
- scrollAndFocus('h3');
- }
- },
- [fetchFutureAppointments, futureStatus, hasTypeChanged],
- );
-
- if (
- futureStatus === FETCH_STATUS.notStarted ||
- futureStatus === FETCH_STATUS.loading
- ) {
- return (
-
-
-
- );
- }
-
- if (futureStatus === FETCH_STATUS.failed) {
- return (
-
- We’re having trouble getting your canceled appointments. Please try
- again later.
-
- );
- }
-
- const keys = Object.keys(appointmentsByMonth);
- return (
- <>
-
- {hasTypeChanged && 'Showing canceled appointments and requests'}
-
- {keys.map((key, monthIndex) => {
- const monthDate = moment(key, 'YYYY-MM');
- const monthBucket = appointmentsByMonth[key];
-
- return (
-
-
- {/* eslint-disable-next-line jsx-a11y/no-redundant-roles */}
-
- {monthBucket.map((appt, index) => {
- const facilityId = getVAAppointmentLocationId(appt);
- const idClickable = `id-${appt.id.replace('.', '\\.')}`;
- const link = getLink({
- featureBreadcrumbUrlUpdate,
- appointment: appt,
- });
-
- if (
- appt.vaos.appointmentType ===
- APPOINTMENT_TYPES.vaAppointment ||
- appt.vaos.appointmentType === APPOINTMENT_TYPES.ccAppointment
- ) {
- return (
-
-
- handleClick({ history, link, idClickable })
- }
- handleKeyDown={() =>
- handleKeyDown({ history, link, idClickable })
- }
- />
-
- );
- }
- return null;
- })}
-
-
- );
- })}
- {!keys?.length && (
-
- {
- recordEvent({
- event: `${GA_PREFIX}-schedule-appointment-button-clicked`,
- });
- dispatch(startNewAppointmentFlow());
- }}
- />
-
- )}
- >
- );
-}
-
-CanceledAppointmentsList.propTypes = {
- hasTypeChanged: PropTypes.bool,
-};
diff --git a/src/applications/vaos/appointment-list/redux/selectors.js b/src/applications/vaos/appointment-list/redux/selectors.js
index 722d87cc9ff9..89b12066e782 100644
--- a/src/applications/vaos/appointment-list/redux/selectors.js
+++ b/src/applications/vaos/appointment-list/redux/selectors.js
@@ -18,7 +18,6 @@ import {
sortByDateAscending,
sortUpcoming,
groupAppointmentsByMonth,
- isCanceledConfirmed,
isUpcomingAppointment,
sortByCreatedDateDescending,
isPendingOrCancelledRequest,
@@ -143,24 +142,6 @@ export const selectPastAppointments = createSelector(
},
);
-export const selectCanceledAppointments = createSelector(
- // Selecting pending here to pull in EC requests
- state => state.appointments.pending,
- state => state.appointments.confirmed,
- (pending, confirmed) => {
- if (!confirmed || !pending) {
- return null;
- }
-
- const sortedAppointments = confirmed
- .concat(pending)
- .filter(isCanceledConfirmed)
- .sort(sortByDateDescending);
-
- return groupAppointmentsByMonth(sortedAppointments);
- },
-);
-
/*
* V2 Past appointments state selectors
*/
@@ -292,16 +273,6 @@ export function selectRequestedAppointmentDetails(state, id) {
};
}
-export function getCanceledAppointmentListInfo(state) {
- return {
- appointmentsByMonth: selectCanceledAppointments(state),
- facilityData: state.appointments.facilityData,
- futureStatus: selectFutureStatus(state),
- isCernerOnlyPatient: selectIsCernerOnlyPatient(state),
- showScheduleButton: selectFeatureRequests(state),
- };
-}
-
export function getRequestedAppointmentListInfo(state) {
return {
facilityData: state.appointments.facilityData,
diff --git a/src/applications/vaos/services/appointment/index.js b/src/applications/vaos/services/appointment/index.js
index cceb28444eea..9714b5aca34a 100644
--- a/src/applications/vaos/services/appointment/index.js
+++ b/src/applications/vaos/services/appointment/index.js
@@ -373,41 +373,6 @@ export function isUpcomingAppointment(appt) {
return false;
}
-/**
- * Returns true if the given Appointment is a canceled confirmed appointment
- *
- * @export
- * @param {Appointment} appt The FHIR Appointment to check
- * @returns {boolean} Whether or not the appointment is a canceled
- * appointment
- */
-export function isCanceledConfirmed(appt) {
- const today = moment();
-
- if (CONFIRMED_APPOINTMENT_TYPES.has(appt.vaos?.appointmentType)) {
- const apptDateTime = moment(appt.start);
-
- return (
- appt.status === APPOINTMENT_STATUS.cancelled &&
- apptDateTime.isValid() &&
- apptDateTime.isAfter(
- today
- .clone()
- .startOf('day')
- .subtract(30, 'days'),
- ) &&
- apptDateTime.isBefore(
- today
- .clone()
- .endOf('day')
- .add(395, 'days'),
- )
- );
- }
-
- return false;
-}
-
/**
* Sort method for past appointments
* @param {Appointment} a A FHIR appointment resource
diff --git a/src/applications/vaos/tests/appointment-list/components/CanceledAppointmentsList.unit.spec.js b/src/applications/vaos/tests/appointment-list/components/CanceledAppointmentsList.unit.spec.js
deleted file mode 100644
index 5fbbfa6f319f..000000000000
--- a/src/applications/vaos/tests/appointment-list/components/CanceledAppointmentsList.unit.spec.js
+++ /dev/null
@@ -1,550 +0,0 @@
-import React from 'react';
-import MockDate from 'mockdate';
-import { expect } from 'chai';
-import moment from 'moment';
-import environment from '@department-of-veterans-affairs/platform-utilities/environment';
-import { mockFetch, setFetchJSONFailure } from 'platform/testing/unit/helpers';
-import reducers from '../../../redux/reducer';
-import { mockAppointmentInfo } from '../../mocks/helpers';
-import { renderWithStoreAndRouter, getTestDate } from '../../mocks/setup';
-import CanceledAppointmentsList from '../../../appointment-list/components/CanceledAppointmentsList';
-import { mockFacilitiesFetchByVersion } from '../../mocks/fetch';
-import {
- createMockAppointmentByVersion,
- createMockFacilityByVersion,
-} from '../../mocks/data';
-import { APPOINTMENT_STATUS, VIDEO_TYPES } from '../../../utils/constants';
-
-const initialState = {
- featureToggles: {
- vaOnlineSchedulingCancel: true,
- },
-};
-
-describe.skip('VAOS Component: CanceledAppointmentsList', () => {
- beforeEach(() => {
- mockFetch();
- MockDate.set(getTestDate());
- mockFacilitiesFetchByVersion({ version: 0 });
- });
- afterEach(() => {
- MockDate.reset();
- });
- it('should show information without facility name', async () => {
- const startDate = moment.utc();
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- clinic: '308',
- start: startDate.format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text('Canceled');
- expect(screen.baseElement).to.contain.text('VA appointment');
-
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
- });
-
- it('should show information with facility name', async () => {
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- vvsKind: VIDEO_TYPES.clinic,
- clinic: '308',
- start: moment().format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
-
- mockFacilitiesFetchByVersion({
- facilities: [
- createMockFacilityByVersion({
- id: '442GC',
- name: 'Cheyenne VA Medical Center',
- address: {
- postalCode: '82001-5356',
- city: 'Cheyenne',
- state: 'WY',
- line: ['2360 East Pershing Boulevard'],
- },
- phone: '307-778-7550',
- version: 0,
- }),
- ],
- version: 0,
- });
-
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(
- moment()
- .tz('America/Denver')
- .format('dddd, MMMM D'),
- 'i',
- ),
- );
-
- expect(
- screen.getByText(
- new RegExp(
- moment()
- .tz('America/Denver')
- .format('h:mm'),
- 'i',
- ),
- ),
- ).to.exist;
- expect(await screen.findByText(/Cheyenne VA Medical Center/i)).to.exist;
- expect(screen.baseElement).not.to.contain.text('VA appointment');
- expect(screen.baseElement).to.contain.text('Canceled');
- });
-
- it('should not display when they have hidden statuses', () => {
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.noshow,
- kind: 'clinic',
- start: moment().format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- return expect(
- screen.findByText(/You don’t have any canceled appointments/i),
- ).to.eventually.be.ok;
- });
-
- it('should not display when over 13 months away', () => {
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- start: moment()
- .add(14, 'months')
- .format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- return expect(
- screen.findByText(/You don’t have any canceled appointments/i),
- ).to.eventually.be.ok;
- });
-
- it('should show error message when request fails', async () => {
- setFetchJSONFailure(
- global.fetch.withArgs(
- `${
- environment.API_URL
- }/vaos/v0/appointment_requests?start_date=${moment()
- .add(-120, 'days')
- .format('YYYY-MM-DD')}&end_date=${moment().format('YYYY-MM-DD')}`,
- ),
- { errors: [] },
- );
-
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- expect(
- await screen.findByText(
- /We’re having trouble getting your canceled appointments/i,
- ),
- ).to.be.ok;
- });
-
- it('should show at home video appointment text', async () => {
- const startDate = moment.utc();
- const data = {
- id: '1234',
- currentStatus: 'CANCELLED BY CLINIC',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'telehealth',
- start: startDate.format(),
- locationId: '983GC',
- telehealth: { vvsKind: VIDEO_TYPES.adhoc },
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text('VA Video Connect at home');
- expect(screen.baseElement).to.contain.text('Canceled');
- });
-
- it('should show ATLAS video appointment text', async () => {
- const startDate = moment.utc();
- const data = {
- id: '1234',
- currentStatus: 'CANCELLED BY CLINIC',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'telehealth',
- start: startDate.format(),
- locationId: '983GC',
- telehealth: {
- vvsKind: VIDEO_TYPES.adhoc,
- atlas: {
- siteCode: '9931',
- slotId: 'Slot8',
- confirmationCode: '7VBBCA',
- address: {
- streetAddress: '114 Dewey Ave',
- city: 'Eureka',
- state: 'MT',
- zipCode: '59917',
- country: 'USA',
- longitude: null,
- latitude: null,
- additionalDetails: '',
- },
- },
- },
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- mockFacilitiesFetchByVersion({ ids: ['442'], version: 0 });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text(
- 'VA Video Connect at an ATLAS location',
- );
- expect(screen.baseElement).to.contain.text('Canceled');
- });
-
- it('should show video appointment on gfe text', async () => {
- const startDate = moment.utc();
- const data = {
- id: '1234',
- currentStatus: 'CANCELLED BY CLINIC',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'telehealth',
- start: startDate.format(),
- locationId: '983GC',
- telehealth: { vvsKind: VIDEO_TYPES.gfe },
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text(
- 'VA Video Connect using a VA device',
- );
- expect(screen.baseElement).to.contain.text('Canceled');
- });
-
- it('should show video appointment at VA location text', async () => {
- const startDate = moment.utc();
- const data = {
- id: '1234',
- currentStatus: 'CANCELLED BY CLINIC',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'telehealth',
- start: startDate.format(),
- locationId: '983GC',
- telehealth: { vvsKind: VIDEO_TYPES.clinic },
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text(
- 'VA Video Connect at a VA location',
- );
- expect(screen.baseElement).to.contain.text('Canceled');
- });
-
- it('should show phone call appointment text', async () => {
- const startDate = moment.utc();
- const data = {
- id: '1234',
- currentStatus: 'CANCELLED BY CLINIC',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'phone',
- clinic: '308',
- start: startDate.format(),
- locationId: '983GC',
- telehealth: { vvsKind: VIDEO_TYPES.clinic },
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- mockFacilitiesFetchByVersion({ ids: ['442GC'], version: 0 });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text('Phone call');
- expect(screen.baseElement).to.contain.text('Canceled');
- });
-
- it('should show canceled appointment from past if less than 30 days ago', async () => {
- const startDate = moment()
- .subtract(28, 'days')
- .utc();
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- clinic: '308',
- start: startDate.format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- mockFacilitiesFetchByVersion({ ids: ['442GC'], version: 0 });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text('Canceled');
- expect(screen.baseElement).to.contain.text('VA appointment');
-
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
- });
-
- it('should show canceled appointment from past if less than 395 days ahead', async () => {
- const startDate = moment()
- .add(393, 'days')
- .utc();
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- clinic: '308',
- start: startDate.format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- mockFacilitiesFetchByVersion({ ids: ['442GC'], version: 0 });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- await screen.findByText(
- new RegExp(startDate.tz('America/Denver').format('dddd, MMMM D'), 'i'),
- );
-
- const timeHeader = screen.getByText(
- new RegExp(startDate.tz('America/Denver').format('h:mm'), 'i'),
- );
-
- expect(screen.queryByText(/You don’t have any appointments/i)).not.to.exist;
- expect(screen.baseElement).to.contain.text('Canceled');
- expect(screen.baseElement).to.contain.text('VA appointment');
-
- expect(timeHeader).to.contain.text('MT');
- expect(timeHeader).to.contain.text('Mountain time');
- });
-
- it('should not show canceled appointment from past if more than 30 days ago', async () => {
- const startDate = moment()
- .subtract(32, 'days')
- .utc();
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- clinic: '308',
- start: startDate.format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- mockFacilitiesFetchByVersion({ ids: ['442GC'], version: 0 });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- return expect(
- screen.findByText(/You don’t have any canceled appointments/i),
- ).to.eventually.be.ok;
- });
-
- it('should not show canceled appointment if more than 395 days ahead', async () => {
- const startDate = moment()
- .add(397, 'days')
- .utc();
- const data = {
- id: '1234',
- status: APPOINTMENT_STATUS.cancelled,
- kind: 'clinic',
- clinic: '308',
- start: startDate.format(),
- locationId: '983GC',
- };
- const appointment = createMockAppointmentByVersion({
- version: 0,
- ...data,
- });
-
- mockAppointmentInfo({ va: [appointment] });
- mockFacilitiesFetchByVersion({ ids: ['442GC'], version: 0 });
- const screen = renderWithStoreAndRouter(, {
- initialState,
- reducers,
- });
-
- return expect(
- screen.findByText(/You don’t have any canceled appointments/i),
- ).to.eventually.be.ok;
- });
-});