diff --git a/src/RoomsAdapter.js b/src/RoomsAdapter.js index 7aac28f..8e27da4 100644 --- a/src/RoomsAdapter.js +++ b/src/RoomsAdapter.js @@ -52,6 +52,18 @@ export default class RoomsAdapter extends WebexAdapter { return throwError(new Error('getRoom(ID) must be defined in RoomsAdapter')); } + /** + * Returns an observable that emits room data of the recently created room + * Observable will complete after one emission. + * + * @param {Room} room Information about the room to create. + * @returns {external:Observable.} Observable stream that emits room data. + * @memberof RoomsAdapter + */ + createRoom(room) { + return throwError(new Error('createRoom(room) must be defined in RoomsAdapter')); + } + /** * Returns an observable that emits an array of current and future activities of the given roomID. * diff --git a/src/RoomsAdapter.test.js b/src/RoomsAdapter.test.js index 8a390f1..aa9a81a 100644 --- a/src/RoomsAdapter.test.js +++ b/src/RoomsAdapter.test.js @@ -29,6 +29,26 @@ describe('Rooms Adapter Interface', () => { }); }); + describe('createRoom()', () => { + test('returns an observable', () => { + expect(isObservable(roomsAdapter.createRoom())).toBeTruthy(); + }); + + test('errors because it needs to be defined', (done) => { + const room = { + title: 'test space', + }; + + roomsAdapter.createRoom(room).subscribe( + () => {}, + (error) => { + expect(error.message).toBe('createRoom(room) must be defined in RoomsAdapter'); + done(); + }, + ); + }); + }); + describe('getActivitiesInRealTime()', () => { test('returns an observable', () => { expect(isObservable(roomsAdapter.getActivitiesInRealTime())).toBeTruthy();