-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Subash Pradhan
committed
Oct 21, 2024
1 parent
3789c46
commit dc9253b
Showing
1 changed file
with
75 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,20 +24,20 @@ describe('Configurations', () => { | |
identifier: 'grant123', | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
|
||
expect(apiClient.request).toHaveBeenCalledWith({ | ||
method: 'GET', | ||
path: '/v3/grants/grant123/scheduling/configurations', | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
}) | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('find', () => { | ||
it('should call apiClient.request with correct params', async () => { | ||
|
@@ -46,87 +46,83 @@ describe('Configurations', () => { | |
configurationId: 'configuration123', | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
|
||
expect(apiClient.request).toHaveBeenCalledWith({ | ||
method: 'GET', | ||
path: '/v3/grants/grant123/scheduling/configurations/configuration123', | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
}) | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('create', () => { | ||
it('should call apiClient.request with correct params', async () => { | ||
await configurations.create({ | ||
identifier: 'grant123', | ||
requestBody: { | ||
"requiresSessionAuth": false, | ||
"participants": [ | ||
requiresSessionAuth: false, | ||
participants: [ | ||
{ | ||
"name": "Test", | ||
"email": "[email protected]", | ||
"availability": { | ||
"calendarIds": [ | ||
"primary" | ||
] | ||
name: 'Test', | ||
email: '[email protected]', | ||
availability: { | ||
calendarIds: ['primary'], | ||
}, | ||
"booking": { | ||
"calendarId": "primary" | ||
} | ||
} | ||
booking: { | ||
calendarId: 'primary', | ||
}, | ||
}, | ||
], | ||
"availability": { | ||
"durationMinutes": 30 | ||
availability: { | ||
durationMinutes: 30, | ||
}, | ||
eventBooking: { | ||
title: 'My test event', | ||
}, | ||
"eventBooking": { | ||
"title": "My test event" | ||
} | ||
}, | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
|
||
expect(apiClient.request).toHaveBeenCalledWith({ | ||
method: 'POST', | ||
path: '/v3/grants/grant123/scheduling/configurations', | ||
body: { | ||
"requiresSessionAuth": false, | ||
"participants": [ | ||
requiresSessionAuth: false, | ||
participants: [ | ||
{ | ||
"name": "Test", | ||
"email": "[email protected]", | ||
"availability": { | ||
"calendarIds": [ | ||
"primary" | ||
] | ||
name: 'Test', | ||
email: '[email protected]', | ||
availability: { | ||
calendarIds: ['primary'], | ||
}, | ||
booking: { | ||
calendarId: 'primary', | ||
}, | ||
"booking": { | ||
"calendarId": "primary" | ||
} | ||
} | ||
}, | ||
], | ||
"availability": { | ||
"durationMinutes": 30 | ||
availability: { | ||
durationMinutes: 30, | ||
}, | ||
eventBooking: { | ||
title: 'My test event', | ||
}, | ||
"eventBooking": { | ||
"title": "My test event" | ||
} | ||
}, | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
}) | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', () => { | ||
it('should call apiClient.request with the correct params', async () => { | ||
|
@@ -135,30 +131,30 @@ describe('Configurations', () => { | |
configurationId: 'configuration123', | ||
requestBody: { | ||
eventBooking: { | ||
title: "Changed Title" | ||
} | ||
title: 'Changed Title', | ||
}, | ||
}, | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
|
||
expect(apiClient.request).toHaveBeenCalledWith({ | ||
method: 'PUT', | ||
path: '/v3/grants/grant123/scheduling/configurations/configuration123', | ||
body: { | ||
eventBooking: { | ||
title: "Changed Title" | ||
} | ||
title: 'Changed Title', | ||
}, | ||
}, | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
}) | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('destroy', () => { | ||
it('should call apiClient.request with the correct params', async () => { | ||
|
@@ -167,18 +163,18 @@ describe('Configurations', () => { | |
configurationId: 'configuration123', | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
|
||
expect(apiClient.request).toHaveBeenCalledWith({ | ||
method: 'DELETE', | ||
path: '/v3/grants/grant123/scheduling/configurations/configuration123', | ||
overrides: { | ||
apiUri: 'https://test.api.nylas.com', | ||
headers: { override: 'foobar' } | ||
} | ||
}) | ||
}) | ||
}) | ||
}) | ||
headers: { override: 'foobar' }, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |