Skip to content

Commit

Permalink
Adds test to verify appointment can be rescheduled with notification …
Browse files Browse the repository at this point in the history
…parameters set
  • Loading branch information
willik committed Oct 31, 2019
1 parent 7217391 commit 490771b
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/resources/appointment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ it('can conditionally not set a filter', async () => {
expected.toHaveProperty('filters', {});
});

it('can reschedule an appointment with new start time', async () => {
it('can reschedule an appointment with the minimum required parameters', async () => {
const resource = new Appointment(mockAxios);
const start = '2018-01-01 12:00:00';

Expand All @@ -350,3 +350,29 @@ it('can reschedule an appointment with new start time', async () => {
},
});
});

it('can reschedule an appointment with all available parameters', async () => {
const resource = new Appointment(mockAxios);
const start = '2018-01-01 12:00:00';
const notifications = [Notifications.CLIENT, Notifications.USER, Notifications.ALL];

notifications.forEach(async (notification: object) => {
await resource
.starting(start)
.notify(notification)
.reschedule(1);

expect(mockAxios.patch).toHaveBeenCalledTimes(1);
expect(mockAxios.patch).toHaveBeenCalledWith('appointments/1', {
data: {
attributes: {
start,
},
type: 'appointments',
},
meta: {
notify: notification,
},
});
});
});

0 comments on commit 490771b

Please sign in to comment.