Skip to content

Commit

Permalink
fix(picker): Fix opentok integration (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcholuj authored Jun 25, 2019
1 parent f5d214b commit 80029db
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
41 changes: 30 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* @private
*/
const PICKER_VERSION = '1.7.1';
const PICKER_VERSION = '1.7.2';

/**
* @private
Expand Down
12 changes: 6 additions & 6 deletions src/lib/api/cloud.spec.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ describe('cloud', () => {
const res = await new CloudClient(testSession).tokInit('audio');

expect(mockTokInit).toHaveBeenCalledWith(expect.any(String), '');
expect(res).toEqual({ body: 'init' });
expect(res).toEqual('init');
});

it('should make correct request to api (video)', async () => {
const res = await new CloudClient(testSession).tokInit('audio');

expect(mockTokInit).toHaveBeenCalledWith(expect.any(String), '');
expect(res).toEqual({ body: 'init' });
expect(res).toEqual('init');
});

it('should throw on wrong type', async() => {
Expand All @@ -379,14 +379,14 @@ describe('cloud', () => {
const res = await new CloudClient(testSession).tokStart('audio', 'key', testTokSession);

expect(mockTokStart).toHaveBeenCalledWith(expect.any(String), JSON.stringify({ apikey: 'key', session_id: testTokSession }));
expect(res).toEqual({ body: 'start' });
expect(res).toEqual('start');
});

it('should make correct request to api (video)', async () => {
const res = await new CloudClient(testSession).tokStart('video', 'key', testTokSession);

expect(mockTokStart).toHaveBeenCalledWith(expect.any(String), JSON.stringify({ apikey: 'key', session_id: testTokSession }));
expect(res).toEqual({ body: 'start' });
expect(res).toEqual('start');
});

it('should throw on wrong type', () => {
Expand All @@ -406,7 +406,7 @@ describe('cloud', () => {
archive_id: testTokArchiveId,
})
);
expect(res).toEqual({ body: 'stop' });
expect(res).toEqual('stop');
});

it('should make correct request to api (video)', async () => {
Expand All @@ -420,7 +420,7 @@ describe('cloud', () => {
archive_id: testTokArchiveId,
})
);
expect(res).toEqual({ body: 'stop' });
expect(res).toEqual('stop');
});

it('should throw on wrong type', () => {
Expand Down
19 changes: 3 additions & 16 deletions src/lib/api/cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,7 @@ export class CloudClient {
throw new FilestackError('Type must be one of video or audio.');
}
return requestWithSource()
.post(`${this.cloudApiUrl}/recording/${type}/init`)
.then(res => {
return {
body: res.data,
};
});
.post(`${this.cloudApiUrl}/recording/${type}/init`).then(res => res.data);
}

tokStart(type: string, key: string, sessionId: string) {
Expand All @@ -221,11 +216,7 @@ export class CloudClient {

return requestWithSource()
.post(`${this.cloudApiUrl}/recording/${type}/start`, payload)
.then(res => {
return {
body: res.data,
};
});
.then(res => res.data);
}

tokStop(type: string, key: string, sessionId: string, archiveId: string) {
Expand All @@ -241,10 +232,6 @@ export class CloudClient {

return requestWithSource()
.post(`${this.cloudApiUrl}/recording/${type}/stop`, payload)
.then(res => {
return {
body: res.data,
};
});
.then(res => res.data);
}
}

0 comments on commit 80029db

Please sign in to comment.