Skip to content

Commit

Permalink
feat(RoomsAdapter): add createRoom method
Browse files Browse the repository at this point in the history
feat(RoomsAdapter): add createRoom method

feat(RoomsAdapter): add createRoom method
  • Loading branch information
kponmuth authored and lalli-flores committed Mar 17, 2022
1 parent 82fb219 commit 4e7c682
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/RoomsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.<Room>} 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.
*
Expand Down
20 changes: 20 additions & 0 deletions src/RoomsAdapter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4e7c682

Please sign in to comment.