Skip to content

Commit

Permalink
Moves query parameter to actual string since it does not work when ca…
Browse files Browse the repository at this point in the history
…lling patch
  • Loading branch information
craigpaul committed Nov 10, 2020
1 parent e86443b commit dd977f5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
40 changes: 15 additions & 25 deletions src/resources/appointment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,14 @@ it('can reschedule an appointment with the minimum required parameters', async (
.reschedule(1, 'code');

expect(mockAxios.patch).toHaveBeenCalledTimes(1);
expect(mockAxios.patch).toHaveBeenCalledWith('appointments/1', {
expect(mockAxios.patch).toHaveBeenCalledWith('appointments/1?code=code', {
data: {
data: {
attributes: {
start,
},
id: 1,
type: 'appointments',
}
},
params: {
code: 'code',
},
attributes: {
start,
},
id: 1,
type: 'appointments',
}
});
});

Expand All @@ -582,22 +577,17 @@ it('can reschedule an appointment with all available parameters', async () => {
.notify(notification)
.reschedule(1, 'code');

expect(mockAxios.patch).toHaveBeenCalledWith('appointments/1', {
expect(mockAxios.patch).toHaveBeenCalledWith('appointments/1?code=code', {
data: {
data: {
attributes: {
start,
timezone: 'America/Toronto',
},
id: 1,
type: 'appointments',
},
meta: {
notify: notification,
attributes: {
start,
timezone: 'America/Toronto',
},
id: 1,
type: 'appointments',
},
params: {
code: 'code',
meta: {
notify: notification,
},
});
}
Expand Down
5 changes: 1 addition & 4 deletions src/resources/appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,7 @@ export default class Appointment extends Conditional implements AppointmentResou
}

public async reschedule(appointment: number, code: string): Promise<any> {
return await this.client.patch(`appointments/${appointment}`, {
data: this.rescheduleParams(appointment),
params: { code }
});
return await this.client.patch(`appointments/${appointment}?code=${code}`, this.rescheduleParams(appointment));
}

public starting(start: string): this {
Expand Down

0 comments on commit dd977f5

Please sign in to comment.