From 8d21d153c544cfb1f0766d8593c90139d1000a33 Mon Sep 17 00:00:00 2001 From: lalli-flores Date: Thu, 30 Jul 2020 15:26:23 -0700 Subject: [PATCH] feat(MeetingAdapter): add incomingMeeting() method definition --- src/MeetingsAdapter.js | 19 +++++++++++++++++-- src/MeetingsAdapter.test.js | 32 ++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/src/MeetingsAdapter.js b/src/MeetingsAdapter.js index 21eb85e..4610d67 100644 --- a/src/MeetingsAdapter.js +++ b/src/MeetingsAdapter.js @@ -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.} 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.} Observable stream that emits meeting data + * @memberof MeetingsAdapter + */ + incomingMeeting(destination) { + return throwError(new Error('incomingMeeting(destination) must be defined in MeetingsAdapter')); } /** diff --git a/src/MeetingsAdapter.test.js b/src/MeetingsAdapter.test.js index 2ef1a73..145c11b 100644 --- a/src/MeetingsAdapter.test.js +++ b/src/MeetingsAdapter.test.js @@ -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(); }, );