-
Notifications
You must be signed in to change notification settings - Fork 126
/
AppointmentCard.unit.spec.js
91 lines (79 loc) · 2.33 KB
/
AppointmentCard.unit.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React from 'react';
import { expect } from 'chai';
import { renderWithStoreAndRouter } from '~/platform/testing/unit/react-testing-library-helpers';
import AppointmentCard from '../AppointmentCard';
import AppointmentDateTime from '../../appointment-list/components/AppointmentDateTime';
import { createTestStore } from '../../tests/mocks/setup';
const appointmentData = {
start: '2024-07-19T08:00:00-07:00',
version: 2,
vaos: {
isCanceled: false,
appointmentType: 'vaAppointment',
isUpcomingAppointment: true,
isPastAppointment: false,
isCompAndPenAppointment: false,
},
videoData: {
isVideo: false,
},
location: {
vistaId: '983',
clinicId: '848',
stationId: '983',
clinicName: 'CHY PC VAR2',
},
};
describe('VAOS Component: AppointmentCard', () => {
const initialState = {
featureToggles: {},
};
it('should display appointment card when vaOnlineSchedulingAppointmentDetailsRedesign is true', async () => {
const state = {
...initialState,
featureToggles: {
...initialState.featureToggles,
vaOnlineSchedulingAppointmentDetailsRedesign: true,
},
};
const store = createTestStore(state);
const appointment = {
...appointmentData,
};
const wrapper = renderWithStoreAndRouter(
<AppointmentCard appointment={appointment}>
<h1 className="vads-u-margin-y--2p5">
<AppointmentDateTime appointment={appointment} />
</h1>
</AppointmentCard>,
{
store,
},
);
expect(wrapper.getByTestId('appointment-card')).to.exist;
});
it('should not display appointment card when vaOnlineSchedulingAppointmentDetailsRedesign is false', async () => {
const state = {
...initialState,
featureToggles: {
...initialState.featureToggles,
vaOnlineSchedulingAppointmentDetailsRedesign: false,
},
};
const store = createTestStore(state);
const appointment = {
...appointmentData,
};
const wrapper = renderWithStoreAndRouter(
<AppointmentCard appointment={appointment}>
<h1 className="vads-u-margin-y--2p5">
<AppointmentDateTime appointment={appointment} />
</h1>
</AppointmentCard>,
{
store,
},
);
expect(wrapper.queryByTestId('appointment-card')).to.be.null;
});
});