Skip to content

Commit

Permalink
feat(MeetingAdapter): add incomingMeeting() method definition
Browse files Browse the repository at this point in the history
  • Loading branch information
lalli-flores committed Jul 31, 2020
1 parent f506848 commit 8d21d15
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
19 changes: 17 additions & 2 deletions src/MeetingsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,27 @@ export default class MeetingsAdapter extends WebexAdapter {
* Observable should complete after emitting data.
* If there is an issue creating the meeting, the observable will error.
*
* @param {string} destination Virtual location where the meeting should take place
* @param {string} destination Virtual location where the meeting will take place
* @returns {external:Observable.<Meeting>} Observable stream that emits meeting data
* @memberof MeetingsAdapter
*/
createMeeting(destination) {
return throwError(new Error('createMeeting(ID) must be defined in MeetingsAdapter'));
return throwError(new Error('createMeeting(destination) must be defined in MeetingsAdapter'));
}

/**
* Listens for incoming meetings at the given destination.
* Returns an observable that emits a Meeting object with the data from the incoming meeting.
* `incomingMeeting` is mostly used for 1:1 meetings where a user tries to reach another user directly.
* This method only notifies that someone is trying to start a meeting, but it has to be used in
* conjunction with `joinMeeting` to actually join the meeting.
*
* @param {string} destination Virtual location where meeting will take place
* @returns {external:Observable.<Meeting>} Observable stream that emits meeting data
* @memberof MeetingsAdapter
*/
incomingMeeting(destination) {
return throwError(new Error('incomingMeeting(destination) must be defined in MeetingsAdapter'));
}

/**
Expand Down
32 changes: 24 additions & 8 deletions src/MeetingsAdapter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,48 @@ describe('Meetings Adapter Interface', () => {
meetingsAdapter = null;
});

describe('getMeeting()', () => {
describe('createMeeting()', () => {
test('returns an observable', () => {
expect(isObservable(meetingsAdapter.getMeeting())).toBeTruthy();
expect(isObservable(meetingsAdapter.createMeeting())).toBeTruthy();
});

test('errors because it needs to be defined', (done) => {
meetingsAdapter.getMeeting('meetingID').subscribe(
meetingsAdapter.createMeeting('sipURI@webex.com').subscribe(
() => {},
(error) => {
expect(error.message).toBe('getMeeting(ID) must be defined in MeetingsAdapter');
expect(error.message).toBe('createMeeting(destination) must be defined in MeetingsAdapter');
done();
},
);
});
});

describe('createMeeting()', () => {
describe('incomingMeeting()', () => {
test('returns an observable', () => {
expect(isObservable(meetingsAdapter.createMeeting())).toBeTruthy();
expect(isObservable(meetingsAdapter.incomingMeeting())).toBeTruthy();
});

test('errors because it needs to be defined', (done) => {
meetingsAdapter.createMeeting('sipURI@webex.com').subscribe(
meetingsAdapter.incomingMeeting('sipURI@webex.com').subscribe(
() => {},
(error) => {
expect(error.message).toBe('incomingMeeting(destination) must be defined in MeetingsAdapter');
done();
},
);
});
});

describe('getMeeting()', () => {
test('returns an observable', () => {
expect(isObservable(meetingsAdapter.getMeeting())).toBeTruthy();
});

test('errors because it needs to be defined', (done) => {
meetingsAdapter.getMeeting('meetingID').subscribe(
() => {},
(error) => {
expect(error.message).toBe('createMeeting(ID) must be defined in MeetingsAdapter');
expect(error.message).toBe('getMeeting(ID) must be defined in MeetingsAdapter');
done();
},
);
Expand Down

0 comments on commit 8d21d15

Please sign in to comment.