Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(meetings): version is now present in the api path #865

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/meetings/__tests__/file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ describe('Meetings > File uploads', () => {
const { url, fields } = awsExpected;
const awsUrl = new URL(url);
scope
.get(`/meetings/themes/logos-upload-urls`)
.get(`/v1/meetings/themes/logos-upload-urls`)
.reply(200, urlResponses)
.put(`/meetings/themes/${themeOne.themeId}/finalizeLogos`, {
.put(`/v1/meetings/themes/${themeOne.themeId}/finalizeLogos`, {
keys: [fields.key],
})
.reply(200, 'OK');
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('Meetings > File uploads', () => {
});

test('Will throw error when AWS fails', async () => {
scope.get(`/meetings/themes/logos-upload-urls`).reply(200, urlResponses);
scope.get(`/v1/meetings/themes/logos-upload-urls`).reply(200, urlResponses);

const awsUrl = new URL(urlResponses[0].url);
awsScope
Expand Down Expand Up @@ -170,9 +170,9 @@ describe('Meetings > File uploads', () => {

test('Will throw error when apply fails', async () => {
scope
.get(`/meetings/themes/logos-upload-urls`)
.get(`/v1/meetings/themes/logos-upload-urls`)
.reply(200, urlResponses)
.put(`/meetings/themes/${themeOne.themeId}/finalizeLogos`, {
.put(`/v1/meetings/themes/${themeOne.themeId}/finalizeLogos`, {
keys: [urlResponses[0].fields.key],
})
.reply(400, {
Expand All @@ -198,9 +198,9 @@ describe('Meetings > File uploads', () => {

test('Will throw error when apply fails with no message', async () => {
scope
.get(`/meetings/themes/logos-upload-urls`)
.get(`/v1/meetings/themes/logos-upload-urls`)
.reply(200, urlResponses)
.put(`/meetings/themes/${themeOne.themeId}/finalizeLogos`, {
.put(`/v1/meetings/themes/${themeOne.themeId}/finalizeLogos`, {
keys: [urlResponses[0].fields.key],
})
.reply(400);
Expand Down
2 changes: 1 addition & 1 deletion packages/meetings/__tests__/numbers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Meetings > Numbers', () => {

test('Can get recording by id', async () => {
scope
.get(`/meetings/dial-in-numbers`)
.get(`/v1/meetings/dial-in-numbers`)
.reply(200, [
Client.transformers.snakeCaseObjectKeys(dialInNumberOne),
Client.transformers.snakeCaseObjectKeys(dialInNumberTwo),
Expand Down
8 changes: 5 additions & 3 deletions packages/meetings/__tests__/recordings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ describe('Meetings > Recordings', () => {
});

test('Can get recording by id', async () => {
scope.get(`/meetings/recordings/my-awesome-recording`).reply(200, session);
scope
.get(`/v1/meetings/recordings/my-awesome-recording`)
.reply(200, session);

expect(await client.getRecording('my-awesome-recording')).toEqual({
...Client.transformers.camelCaseObjectKeys(session, true),
Expand All @@ -44,7 +46,7 @@ describe('Meetings > Recordings', () => {
});

test('Can get recordings for session', async () => {
scope.get(`/meetings/sessions/my-session`).reply(200, {
scope.get(`/v1/meetings/sessions/my-session`).reply(200, {
_embedded: {
recordings: [session],
},
Expand All @@ -61,7 +63,7 @@ describe('Meetings > Recordings', () => {
});

test('Can delete recording by id', async () => {
scope.delete(`/meetings/recordings/my-awesome-recording`).reply(204);
scope.delete(`/v1/meetings/recordings/my-awesome-recording`).reply(204);

await client.deleteRecording('my-awesome-recording');

Expand Down
28 changes: 14 additions & 14 deletions packages/meetings/__tests__/room.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Meetings > Rooms', () => {
});

test('Can get one page of data', async () => {
scope.get(`/meetings/rooms?`).reply(200, {
scope.get(`/v1/meetings/rooms?`).reply(200, {
_embedded: [
{
...roomOne,
Expand All @@ -34,7 +34,7 @@ describe('Meetings > Rooms', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
},
page_size: 20,
Expand All @@ -52,7 +52,7 @@ describe('Meetings > Rooms', () => {

test('Can get two pages of data', async () => {
scope
.get(`/meetings/rooms?page_size=1`)
.get(`/v1/meetings/rooms?page_size=1`)
.reply(200, {
_embedded: [
{
Expand All @@ -62,16 +62,16 @@ describe('Meetings > Rooms', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
next: {
href: `${BASE_URL}/meetings/rooms?start_id=42`,
href: `${BASE_URL}/v1/meetings/rooms?start_id=42`,
},
},
page_size: 20,
total_items: 1,
})
.get(`/meetings/rooms?page_size=1&start_id=42`)
.get(`/v1/meetings/rooms?page_size=1&start_id=42`)
.reply(200, {
_embedded: [
{
Expand All @@ -81,7 +81,7 @@ describe('Meetings > Rooms', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
},
page_size: 20,
Expand All @@ -102,7 +102,7 @@ describe('Meetings > Rooms', () => {

test('Will throw error when call fails', async () => {
scope
.get(`/meetings/rooms?`)
.get(`/v1/meetings/rooms?`)
.reply(200, {
_embedded: [
{
Expand All @@ -112,16 +112,16 @@ describe('Meetings > Rooms', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
next: {
href: `${BASE_URL}/meetings/rooms?start_id=42`,
href: `${BASE_URL}/v1/meetings/rooms?start_id=42`,
},
},
page_size: 20,
total_items: 1,
})
.get(`/meetings/rooms?start_id=42`)
.get(`/v1/meetings/rooms?start_id=42`)
.reply(401, {
status: 401,
error: 'Unauthorized',
Expand All @@ -140,7 +140,7 @@ describe('Meetings > Rooms', () => {
});

test('Can get room by id', async () => {
scope.get(`/meetings/rooms/my-awesome-room`).reply(200, {
scope.get(`/v1/meetings/rooms/my-awesome-room`).reply(200, {
...roomOne,
_links: roomLinks,
});
Expand All @@ -155,7 +155,7 @@ describe('Meetings > Rooms', () => {
test('Can create room', async () => {
scope
.post(
`/meetings/rooms`,
`/v1/meetings/rooms`,
pick(
Client.transformers.snakeCaseObjectKeys(roomOne, true),
client.ROOM_WRITE_KEYS,
Expand All @@ -175,7 +175,7 @@ describe('Meetings > Rooms', () => {

test('Can Update an existing room', async () => {
scope
.patch(`/meetings/rooms/my-awesome-room`, {
.patch(`/v1/meetings/rooms/my-awesome-room`, {
update_options: pick(
Client.transformers.snakeCaseObjectKeys(roomOne, true),
client.ROOM_WRITE_KEYS,
Expand Down
40 changes: 20 additions & 20 deletions packages/meetings/__tests__/theme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Meetings > Themes', () => {
});

test('Can get empty themes', async () => {
scope.get(`/meetings/themes`).reply(200, []);
scope.get(`/v1/meetings/themes`).reply(200, []);

const results = [];
for await (const room of client.getThemes()) {
Expand All @@ -40,7 +40,7 @@ describe('Meetings > Themes', () => {

test('Can get themes', async () => {
scope
.get(`/meetings/themes`)
.get(`/v1/meetings/themes`)
.reply(200, [
Client.transformers.snakeCaseObjectKeys(themeOne),
Client.transformers.snakeCaseObjectKeys(themeTwo),
Expand All @@ -57,7 +57,7 @@ describe('Meetings > Themes', () => {

test('Can get theme', async () => {
scope
.get(`/meetings/themes/my-theme`)
.get(`/v1/meetings/themes/my-theme`)
.reply(200, Client.transformers.snakeCaseObjectKeys(themeOne));

expect(await client.getTheme('my-theme')).toEqual(themeOne);
Expand All @@ -66,7 +66,7 @@ describe('Meetings > Themes', () => {

test('Can delete theme', async () => {
scope
.delete(`/meetings/themes/my-theme`)
.delete(`/v1/meetings/themes/my-theme`)
.reply(200, Client.transformers.snakeCaseObjectKeys(themeOne));

await client.deleteTheme('my-theme');
Expand All @@ -75,15 +75,15 @@ describe('Meetings > Themes', () => {

test('Can force delete theme', async () => {
scope
.delete(`/meetings/themes/my-theme?force=true`)
.delete(`/v1/meetings/themes/my-theme?force=true`)
.reply(200, Client.transformers.snakeCaseObjectKeys(themeOne));

await client.deleteTheme('my-theme', true);
expect(nock.isDone()).toBeTruthy();
});

test('Will throw when theme in use', async () => {
scope.delete(`/meetings/themes/my-theme`).reply(400, {
scope.delete(`/v1/meetings/themes/my-theme`).reply(400, {
message: 'could not delete theme',
name: 'BadRequestError',
errors: [
Expand All @@ -101,7 +101,7 @@ describe('Meetings > Themes', () => {
test('Will create a theme', async () => {
scope
.post(
`/meetings/themes`,
`/v1/meetings/themes`,
pick(
Client.transformers.snakeCaseObjectKeys(themeOne, true),
client.THEME_WRITE_KEYS,
Expand All @@ -115,7 +115,7 @@ describe('Meetings > Themes', () => {

test('Will update a theme', async () => {
scope
.patch(`/meetings/themes/my-theme`, {
.patch(`/v1/meetings/themes/my-theme`, {
update_details: pick(
Client.transformers.snakeCaseObjectKeys(themeOne, true),
client.THEME_WRITE_KEYS,
Expand All @@ -128,7 +128,7 @@ describe('Meetings > Themes', () => {
});

test('Can get one page of theme rooms', async () => {
scope.get(`/meetings/themes/my-theme/rooms?`).reply(200, {
scope.get(`/v1/meetings/themes/my-theme/rooms?`).reply(200, {
_embedded: [
{
...roomOne,
Expand All @@ -137,7 +137,7 @@ describe('Meetings > Themes', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
},
page_size: 20,
Expand All @@ -155,7 +155,7 @@ describe('Meetings > Themes', () => {

test('Can get two pages of theme rooms', async () => {
scope
.get(`/meetings/themes/my-theme/rooms?page_size=1`)
.get(`/v1/meetings/themes/my-theme/rooms?page_size=1`)
.reply(200, {
_embedded: [
{
Expand All @@ -165,16 +165,16 @@ describe('Meetings > Themes', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
next: {
href: `${BASE_URL}/meetings/rooms?start_id=42`,
href: `${BASE_URL}/v1/meetings/rooms?start_id=42`,
},
},
page_size: 20,
total_items: 1,
})
.get(`/meetings/themes/my-theme/rooms?page_size=1&start_id=42`)
.get(`/v1/meetings/themes/my-theme/rooms?page_size=1&start_id=42`)
.reply(200, {
_embedded: [
{
Expand All @@ -184,7 +184,7 @@ describe('Meetings > Themes', () => {
],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
},
page_size: 20,
Expand All @@ -207,21 +207,21 @@ describe('Meetings > Themes', () => {

test('Will throw error when call to theme rooms fails', async () => {
scope
.get(`/meetings/themes/my-theme/rooms?`)
.get(`/v1/meetings/themes/my-theme/rooms?`)
.reply(200, {
_embedded: [roomOne],
_links: {
self: {
href: `${BASE_URL}/meetings/rooms`,
href: `${BASE_URL}/v1/meetings/rooms`,
},
next: {
href: `${BASE_URL}/meetings/rooms?start_id=42`,
href: `${BASE_URL}/v1/meetings/rooms?start_id=42`,
},
},
page_size: 20,
total_items: 1,
})
.get(`/meetings/themes/my-theme/rooms?start_id=42`)
.get(`/v1/meetings/themes/my-theme/rooms?start_id=42`)
.reply(401, {
status: 401,
error: 'Unauthorized',
Expand All @@ -241,7 +241,7 @@ describe('Meetings > Themes', () => {

test('Will set default theme', async () => {
scope
.patch(`/meetings/applications`, {
.patch(`/v1/meetings/applications`, {
update_details: {
default_theme_id: 'my-theme',
},
Expand Down
Loading