chore: Add test for booking cancelled webhook (#14940)
* chore: Add test for booking cancelled webhook * added unit test * assertions to check booking created successfully * remove booking cancelled e2e * test: add webhook cancelled test * chore: remove old test --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Udit Takkar <udit222001@gmail.com>
This commit is contained in:
2 files changed
+143
-9
No files matched your search
@@ -290,12 +290,16 @@ export function expectWebhookToHaveBeenCalledWith(
|
||||
|
||||
if (parsedBody.payload) {
|
||||
if (data.payload) {
|
||||
if (data.payload.metadata !== undefined) {
|
||||
if (!!data.payload.metadata) {
|
||||
expect(parsedBody.payload.metadata).toEqual(expect.objectContaining(data.payload.metadata));
|
||||
}
|
||||
if (data.payload.responses !== undefined)
|
||||
if (!!data.payload.responses)
|
||||
expect(parsedBody.payload.responses).toEqual(expect.objectContaining(data.payload.responses));
|
||||
const { responses: _1, metadata: _2, ...remainingPayload } = data.payload;
|
||||
|
||||
if (!!data.payload.organizer)
|
||||
expect(parsedBody.payload.organizer).toEqual(expect.objectContaining(data.payload.organizer));
|
||||
|
||||
const { responses: _1, metadata: _2, organizer: _3, ...remainingPayload } = data.payload;
|
||||
expect(parsedBody.payload).toEqual(expect.objectContaining(remainingPayload));
|
||||
}
|
||||
}
|
||||
@@ -989,20 +993,17 @@ export function expectBookingCancelledWebhookToHaveBeenFired({
|
||||
...payload,
|
||||
metadata: null,
|
||||
responses: {
|
||||
booker: {
|
||||
label: "your_name",
|
||||
name: {
|
||||
label: "name",
|
||||
value: booker.name,
|
||||
isHidden: false,
|
||||
},
|
||||
email: {
|
||||
label: "email_address",
|
||||
label: "email",
|
||||
value: booker.email,
|
||||
isHidden: false,
|
||||
},
|
||||
location: {
|
||||
label: "location",
|
||||
value: { optionValue: "", value: location },
|
||||
isHidden: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user