@webex/plugin-rooms 3.0.0-beta.8 → 3.0.0-bnr.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/dist/index.js +1 -8
- package/dist/index.js.map +1 -1
- package/dist/plugin-rooms.d.ts +12 -0
- package/dist/rooms.js +92 -168
- package/dist/rooms.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/rooms.d.ts +41 -0
- package/package.json +12 -12
- package/src/rooms.js +76 -78
- package/test/integration/spec/rooms.js +218 -190
|
@@ -8,11 +8,7 @@ import '@webex/plugin-rooms';
|
|
|
8
8
|
import '@webex/plugin-memberships';
|
|
9
9
|
import '@webex/plugin-messages';
|
|
10
10
|
import WebexCore, {WebexHttpError} from '@webex/webex-core';
|
|
11
|
-
import {
|
|
12
|
-
SDK_EVENT,
|
|
13
|
-
hydraTypes,
|
|
14
|
-
constructHydraId
|
|
15
|
-
} from '@webex/common';
|
|
11
|
+
import {SDK_EVENT, hydraTypes, constructHydraId} from '@webex/common';
|
|
16
12
|
import {assert} from '@webex/test-helper-chai';
|
|
17
13
|
import sinon from 'sinon';
|
|
18
14
|
import testUsers from '@webex/test-helper-test-users';
|
|
@@ -24,21 +20,21 @@ describe('plugin-rooms', function () {
|
|
|
24
20
|
|
|
25
21
|
let webex, actor;
|
|
26
22
|
|
|
27
|
-
before(() =>
|
|
28
|
-
.then(async ([user]) => {
|
|
23
|
+
before(() =>
|
|
24
|
+
testUsers.create({count: 1}).then(async ([user]) => {
|
|
29
25
|
// Pause for 5 seconds for CI
|
|
30
26
|
await new Promise((done) => setTimeout(done, 5000));
|
|
31
27
|
|
|
32
28
|
webex = new WebexCore({credentials: user.token});
|
|
33
29
|
|
|
34
|
-
return webex.people.get('me')
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
return webex.people.get('me').then((person) => {
|
|
31
|
+
actor = person;
|
|
32
|
+
debug('SDK User (Actor) for tests:');
|
|
33
|
+
debug(`- name: ${actor.displayName}`);
|
|
34
|
+
debug(`- id: ${actor.id}`);
|
|
35
|
+
});
|
|
36
|
+
})
|
|
37
|
+
);
|
|
42
38
|
|
|
43
39
|
describe('#rooms', () => {
|
|
44
40
|
const rooms = [];
|
|
@@ -48,15 +44,17 @@ describe('plugin-rooms', function () {
|
|
|
48
44
|
webex.rooms.off('created');
|
|
49
45
|
webex.rooms.off('updated');
|
|
50
46
|
|
|
51
|
-
return Promise.all(
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
return Promise.all(
|
|
48
|
+
rooms.map((room) =>
|
|
49
|
+
webex.rooms.remove(room).catch((reason) => {
|
|
50
|
+
console.error('Failed to delete room', reason);
|
|
51
|
+
})
|
|
52
|
+
)
|
|
53
|
+
).then(() => {
|
|
54
|
+
while (rooms.length) {
|
|
55
|
+
rooms.pop();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
60
58
|
});
|
|
61
59
|
|
|
62
60
|
describe('#create()', () => {
|
|
@@ -68,23 +66,23 @@ describe('plugin-rooms', function () {
|
|
|
68
66
|
});
|
|
69
67
|
});
|
|
70
68
|
|
|
71
|
-
return webex.rooms.listen()
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const event = await createdEventPromise;
|
|
69
|
+
return webex.rooms.listen().then(() =>
|
|
70
|
+
webex.rooms.create({title: 'Webex Test Room'}).then(async (room) => {
|
|
71
|
+
assert.isRoom(room);
|
|
72
|
+
rooms.push(room); // for future cleanup
|
|
73
|
+
const event = await createdEventPromise;
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
validateRoomEvent(event, room, actor);
|
|
76
|
+
})
|
|
77
|
+
);
|
|
80
78
|
});
|
|
81
79
|
});
|
|
82
80
|
|
|
83
81
|
describe('#one-on-one()', () => {
|
|
84
82
|
let user1, room;
|
|
85
83
|
|
|
86
|
-
before(() =>
|
|
87
|
-
.then(async (users) => {
|
|
84
|
+
before(() =>
|
|
85
|
+
testUsers.create({count: 1}).then(async (users) => {
|
|
88
86
|
// Pause for 5 seconds for CI
|
|
89
87
|
await new Promise((done) => setTimeout(done, 5000));
|
|
90
88
|
|
|
@@ -92,7 +90,8 @@ describe('plugin-rooms', function () {
|
|
|
92
90
|
debug('Test User for One-on-One room:');
|
|
93
91
|
debug(`- name: ${user1.displayName}`);
|
|
94
92
|
debug(`- id: ${constructHydraId(hydraTypes.PEOPLE, user1.id)}`);
|
|
95
|
-
})
|
|
93
|
+
})
|
|
94
|
+
);
|
|
96
95
|
|
|
97
96
|
// We need a one-on-on space for this test
|
|
98
97
|
// We create it by sending a message to the test user
|
|
@@ -105,11 +104,12 @@ describe('plugin-rooms', function () {
|
|
|
105
104
|
});
|
|
106
105
|
});
|
|
107
106
|
|
|
108
|
-
return webex.rooms.listen()
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
return webex.rooms.listen().then(() =>
|
|
108
|
+
webex.messages
|
|
109
|
+
.create({
|
|
110
|
+
toPersonId: user1.id,
|
|
111
|
+
text: 'Message to start a one-on-on space',
|
|
112
|
+
})
|
|
113
113
|
.then((message) => {
|
|
114
114
|
assert.exists(message.roomId);
|
|
115
115
|
|
|
@@ -121,27 +121,28 @@ describe('plugin-rooms', function () {
|
|
|
121
121
|
const event = await createdEventPromise;
|
|
122
122
|
|
|
123
123
|
validateRoomEvent(event, room, actor);
|
|
124
|
-
})
|
|
124
|
+
})
|
|
125
|
+
);
|
|
125
126
|
});
|
|
126
127
|
});
|
|
127
128
|
|
|
128
129
|
describe('#get()', () => {
|
|
129
130
|
let room0;
|
|
130
131
|
|
|
131
|
-
beforeEach(() =>
|
|
132
|
-
|
|
133
|
-
.then((room) => {
|
|
132
|
+
beforeEach(() =>
|
|
133
|
+
Promise.all([
|
|
134
|
+
webex.rooms.create({title: 'Webex Test Room 1'}).then((room) => {
|
|
134
135
|
rooms.push(room);
|
|
135
136
|
}),
|
|
136
|
-
|
|
137
|
-
.then((room) => {
|
|
137
|
+
webex.rooms.create({title: 'Webex Test Room 0'}).then((room) => {
|
|
138
138
|
rooms.push(room);
|
|
139
139
|
room0 = room;
|
|
140
|
-
})
|
|
141
|
-
|
|
140
|
+
}),
|
|
141
|
+
])
|
|
142
|
+
);
|
|
142
143
|
|
|
143
|
-
it('retrieves a specific room', () =>
|
|
144
|
-
.then((room) => {
|
|
144
|
+
it('retrieves a specific room', () =>
|
|
145
|
+
webex.rooms.get(room0).then((room) => {
|
|
145
146
|
assert.isRoom(room);
|
|
146
147
|
|
|
147
148
|
assert.equal(room.id, room0.id);
|
|
@@ -154,33 +155,36 @@ describe('plugin-rooms', function () {
|
|
|
154
155
|
// the tests rely on ordering.
|
|
155
156
|
let room0, room1;
|
|
156
157
|
|
|
157
|
-
beforeEach(() =>
|
|
158
|
-
.then((room) => {
|
|
158
|
+
beforeEach(() =>
|
|
159
|
+
webex.rooms.create({title: 'Webex Test Room 1'}).then((room) => {
|
|
159
160
|
rooms.push(room);
|
|
160
161
|
room1 = room;
|
|
161
|
-
})
|
|
162
|
+
})
|
|
163
|
+
);
|
|
162
164
|
|
|
163
|
-
beforeEach(() =>
|
|
164
|
-
.then((room) => {
|
|
165
|
+
beforeEach(() =>
|
|
166
|
+
webex.rooms.create({title: 'Webex Test Room 0'}).then((room) => {
|
|
165
167
|
rooms.push(room);
|
|
166
168
|
room0 = room;
|
|
167
|
-
})
|
|
169
|
+
})
|
|
170
|
+
);
|
|
168
171
|
|
|
169
|
-
it('retrieves all the rooms to which I have access', () =>
|
|
170
|
-
.then((rooms) => {
|
|
172
|
+
it('retrieves all the rooms to which I have access', () =>
|
|
173
|
+
webex.rooms.list().then((rooms) => {
|
|
171
174
|
for (const room of rooms) {
|
|
172
175
|
assert.isRoom(room);
|
|
173
176
|
}
|
|
174
|
-
assert.equal(rooms.items[0].id, room0.id,
|
|
175
|
-
assert.equal(rooms.items[0].title, room0.title,
|
|
176
|
-
assert.equal(rooms.items[1].id, room1.id,
|
|
177
|
-
assert.equal(rooms.items[1].title, room1.title,
|
|
177
|
+
assert.equal(rooms.items[0].id, room0.id, "Room 0's id matches");
|
|
178
|
+
assert.equal(rooms.items[0].title, room0.title, "Room 0's title matches");
|
|
179
|
+
assert.equal(rooms.items[1].id, room1.id, "Room 1's id matches");
|
|
180
|
+
assert.equal(rooms.items[1].title, room1.title, "Room 1's title matches");
|
|
178
181
|
}));
|
|
179
182
|
|
|
180
183
|
it('retrieves a bounded, pageable set of rooms to which I have access', () => {
|
|
181
184
|
const spy = sinon.spy();
|
|
182
185
|
|
|
183
|
-
return webex.rooms
|
|
186
|
+
return webex.rooms
|
|
187
|
+
.list({max: 1})
|
|
184
188
|
.then((rooms) => {
|
|
185
189
|
assert.lengthOf(rooms, 1);
|
|
186
190
|
|
|
@@ -194,7 +198,7 @@ describe('plugin-rooms', function () {
|
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
return Promise.resolve();
|
|
197
|
-
}(rooms)
|
|
201
|
+
})(rooms);
|
|
198
202
|
})
|
|
199
203
|
.then(() => {
|
|
200
204
|
assert.isAbove(spy.callCount, 1);
|
|
@@ -207,46 +211,56 @@ describe('plugin-rooms', function () {
|
|
|
207
211
|
describe('#getWithReadStatus()', () => {
|
|
208
212
|
let room1, user2;
|
|
209
213
|
|
|
210
|
-
before(() =>
|
|
211
|
-
.then(async ([user]) => {
|
|
214
|
+
before(() =>
|
|
215
|
+
testUsers.create({count: 1}).then(async ([user]) => {
|
|
212
216
|
// Pause for 5 seconds for CI
|
|
213
217
|
await new Promise((done) => setTimeout(done, 5000));
|
|
214
218
|
|
|
215
219
|
user2 = user;
|
|
216
220
|
user2.webex = new WebexCore({credentials: user2.token});
|
|
217
|
-
})
|
|
221
|
+
})
|
|
222
|
+
);
|
|
218
223
|
|
|
219
224
|
// Create a space with one user who is "caught up" and another "behind"
|
|
220
|
-
beforeEach(() =>
|
|
221
|
-
.
|
|
222
|
-
|
|
223
|
-
|
|
225
|
+
beforeEach(() =>
|
|
226
|
+
webex.rooms
|
|
227
|
+
.create({title: 'Space to get Read Status from'})
|
|
228
|
+
.then((room) => {
|
|
229
|
+
rooms.push(room);
|
|
230
|
+
room1 = room;
|
|
224
231
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
232
|
+
return webex.memberships.create({
|
|
233
|
+
roomId: room1.id,
|
|
234
|
+
personId: user2.id,
|
|
235
|
+
});
|
|
236
|
+
})
|
|
237
|
+
// User 1 will post a message, that user2 won't have seen
|
|
238
|
+
.then(() =>
|
|
239
|
+
webex.messages.create({
|
|
240
|
+
roomId: room1.id,
|
|
241
|
+
text: 'First message in room 1 from User 1',
|
|
242
|
+
})
|
|
243
|
+
)
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
it('gets the read status for new room for user1', () =>
|
|
247
|
+
webex.rooms.getWithReadStatus(room1.id).then((roomInfo) => {
|
|
248
|
+
assert.equal(roomInfo.id, room1.id, "Room 1's title matches");
|
|
249
|
+
assert.equal(roomInfo.title, room1.title, "Room 1's title matches");
|
|
250
|
+
assert.isTrue(
|
|
251
|
+
roomInfo.lastSeenActivityDate >= roomInfo.lastActivityDate,
|
|
252
|
+
'Room 1 is read for User 1'
|
|
253
|
+
);
|
|
242
254
|
}));
|
|
243
255
|
|
|
244
|
-
it('gets the read status for a new room for user2', () =>
|
|
245
|
-
.then((roomInfo) => {
|
|
246
|
-
assert.equal(roomInfo.id, room1.id,
|
|
247
|
-
assert.equal(roomInfo.title, room1.title,
|
|
248
|
-
assert.isTrue(
|
|
249
|
-
|
|
256
|
+
it('gets the read status for a new room for user2', () =>
|
|
257
|
+
user2.webex.rooms.getWithReadStatus(room1.id).then((roomInfo) => {
|
|
258
|
+
assert.equal(roomInfo.id, room1.id, "Room 1's title matches");
|
|
259
|
+
assert.equal(roomInfo.title, room1.title, "Room 1's title matches");
|
|
260
|
+
assert.isTrue(
|
|
261
|
+
roomInfo.lastSeenActivityDate < roomInfo.lastActivityDate,
|
|
262
|
+
'Room 1 is unread for User 2'
|
|
263
|
+
);
|
|
250
264
|
}));
|
|
251
265
|
});
|
|
252
266
|
|
|
@@ -255,83 +269,100 @@ describe('plugin-rooms', function () {
|
|
|
255
269
|
// the tests rely on ordering.
|
|
256
270
|
let room1, room2, user2;
|
|
257
271
|
|
|
258
|
-
before(() =>
|
|
259
|
-
.then(async ([user]) => {
|
|
272
|
+
before(() =>
|
|
273
|
+
testUsers.create({count: 1}).then(async ([user]) => {
|
|
260
274
|
// Pause for 5 seconds for CI
|
|
261
275
|
await new Promise((done) => setTimeout(done, 5000));
|
|
262
276
|
|
|
263
277
|
user2 = user;
|
|
264
278
|
user2.webex = new WebexCore({credentials: user2.token});
|
|
265
|
-
})
|
|
279
|
+
})
|
|
280
|
+
);
|
|
266
281
|
|
|
267
282
|
// Create two spaces with a message from each user in one of them
|
|
268
|
-
beforeEach(() =>
|
|
269
|
-
.
|
|
270
|
-
|
|
271
|
-
|
|
283
|
+
beforeEach(() =>
|
|
284
|
+
webex.rooms
|
|
285
|
+
.create({title: 'Unread Message for User 2'})
|
|
286
|
+
.then((room) => {
|
|
287
|
+
rooms.push(room);
|
|
288
|
+
room1 = room;
|
|
272
289
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
rooms.
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
290
|
+
return webex.memberships.create({
|
|
291
|
+
roomId: room1.id,
|
|
292
|
+
personId: user2.id,
|
|
293
|
+
});
|
|
294
|
+
})
|
|
295
|
+
// User 1 will post a message, that user2 won't have seen
|
|
296
|
+
.then(() =>
|
|
297
|
+
webex.messages.create({
|
|
298
|
+
roomId: room1.id,
|
|
299
|
+
text: 'First message in room 1 from User 1',
|
|
300
|
+
})
|
|
301
|
+
)
|
|
302
|
+
// Now create the second space with the two members
|
|
303
|
+
.then(() => webex.rooms.create({title: 'Unread Message for User 1'}))
|
|
304
|
+
.then((room) => {
|
|
305
|
+
rooms.push(room);
|
|
306
|
+
room2 = room;
|
|
307
|
+
})
|
|
308
|
+
.then(() =>
|
|
309
|
+
webex.memberships.create({
|
|
310
|
+
roomId: room2.id,
|
|
311
|
+
personId: user2.id,
|
|
312
|
+
})
|
|
313
|
+
)
|
|
314
|
+
// User 2 will post a message, that User 1 won't have seen
|
|
315
|
+
.then(() =>
|
|
316
|
+
user2.webex.messages.create({
|
|
317
|
+
roomId: room2.id,
|
|
318
|
+
text: 'First message in room 2 from User 2',
|
|
319
|
+
})
|
|
320
|
+
)
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
it('gets the read status for all rooms User 1 is in', () =>
|
|
324
|
+
webex.rooms.listWithReadStatus().then((roomList) => {
|
|
325
|
+
assert.isArray(roomList.items, 'Expect a list or rooms from listWithReadStatus()');
|
|
326
|
+
assert.isAbove(
|
|
327
|
+
roomList.items.length,
|
|
328
|
+
1,
|
|
329
|
+
'Expected two or more rooms from listWithReadStatus()'
|
|
330
|
+
);
|
|
305
331
|
for (const room of roomList.items) {
|
|
306
332
|
if (room.id === room1.id) {
|
|
307
|
-
assert.equal(room.title, room1.title,
|
|
308
|
-
assert.isTrue(
|
|
309
|
-
|
|
333
|
+
assert.equal(room.title, room1.title, "Room 1's title matches");
|
|
334
|
+
assert.isTrue(
|
|
335
|
+
room.lastSeenActivityDate >= room.lastActivityDate,
|
|
336
|
+
'Room 1 is read for User 1'
|
|
337
|
+
);
|
|
310
338
|
}
|
|
311
339
|
if (room.id === room2.id) {
|
|
312
|
-
assert.equal(room.title, room2.title,
|
|
313
|
-
assert.isTrue(
|
|
314
|
-
|
|
340
|
+
assert.equal(room.title, room2.title, "Room 2's title matches");
|
|
341
|
+
assert.isTrue(
|
|
342
|
+
room.lastSeenActivityDate < room.lastActivityDate,
|
|
343
|
+
'Room 2 is unread for User 1'
|
|
344
|
+
);
|
|
315
345
|
}
|
|
316
346
|
}
|
|
317
347
|
}));
|
|
318
348
|
|
|
319
|
-
it('gets the read status for all rooms User 2 is in', () =>
|
|
320
|
-
.then((roomList) => {
|
|
321
|
-
assert.isArray(roomList.items,
|
|
322
|
-
|
|
323
|
-
assert.equal(roomList.items.length, 2,
|
|
324
|
-
'Expected two rooms from listWithReadStatus()');
|
|
349
|
+
it('gets the read status for all rooms User 2 is in', () =>
|
|
350
|
+
user2.webex.rooms.listWithReadStatus().then((roomList) => {
|
|
351
|
+
assert.isArray(roomList.items, 'Expect a list or rooms from listWithReadStatus()');
|
|
352
|
+
assert.equal(roomList.items.length, 2, 'Expected two rooms from listWithReadStatus()');
|
|
325
353
|
for (const room of roomList.items) {
|
|
326
354
|
if (room.id === room1.id) {
|
|
327
|
-
assert.equal(room.title, room1.title,
|
|
328
|
-
assert.isTrue(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
assert.
|
|
334
|
-
|
|
355
|
+
assert.equal(room.title, room1.title, "Room 1's title matches");
|
|
356
|
+
assert.isTrue(
|
|
357
|
+
room.lastSeenActivityDate < room.lastActivityDate,
|
|
358
|
+
'Room 1 is unread for User 2'
|
|
359
|
+
);
|
|
360
|
+
} else {
|
|
361
|
+
assert.equal(room.title, room2.title, "Room 2's title matches");
|
|
362
|
+
assert.isTrue(
|
|
363
|
+
room.lastSeenActivityDate >= room.lastActivityDate,
|
|
364
|
+
'Room 2 is read for User 2'
|
|
365
|
+
);
|
|
335
366
|
}
|
|
336
367
|
}
|
|
337
368
|
}));
|
|
@@ -340,14 +371,15 @@ describe('plugin-rooms', function () {
|
|
|
340
371
|
describe('#update()', () => {
|
|
341
372
|
let room;
|
|
342
373
|
|
|
343
|
-
beforeEach(() =>
|
|
344
|
-
.then((r) => {
|
|
374
|
+
beforeEach(() =>
|
|
375
|
+
webex.rooms.create({title: 'Webex Test Room'}).then((r) => {
|
|
345
376
|
room = r;
|
|
346
377
|
rooms.push(room);
|
|
347
378
|
assert.property(room, 'id');
|
|
348
|
-
})
|
|
379
|
+
})
|
|
380
|
+
);
|
|
349
381
|
|
|
350
|
-
it(
|
|
382
|
+
it("updates a single room's title and validates a room:updated event", () => {
|
|
351
383
|
const r = Object.assign({}, room, {title: 'Webex Test Room with New Title'});
|
|
352
384
|
const updatedEventPromise = new Promise((resolve) => {
|
|
353
385
|
webex.rooms.on('updated', (event) => {
|
|
@@ -356,36 +388,39 @@ describe('plugin-rooms', function () {
|
|
|
356
388
|
});
|
|
357
389
|
});
|
|
358
390
|
|
|
359
|
-
return webex.rooms.listen()
|
|
360
|
-
.then(() =>
|
|
361
|
-
.
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const event = await updatedEventPromise;
|
|
391
|
+
return webex.rooms.listen().then(() =>
|
|
392
|
+
webex.rooms.update(r).then(async (room) => {
|
|
393
|
+
assert.isRoom(room);
|
|
394
|
+
assert.deepEqual(room, r);
|
|
395
|
+
const event = await updatedEventPromise;
|
|
365
396
|
|
|
366
|
-
|
|
367
|
-
|
|
397
|
+
validateRoomEvent(event, room, actor);
|
|
398
|
+
})
|
|
399
|
+
);
|
|
368
400
|
});
|
|
369
401
|
});
|
|
370
402
|
|
|
371
403
|
describe('#remove()', () => {
|
|
372
404
|
let room;
|
|
373
405
|
|
|
374
|
-
beforeEach(() =>
|
|
375
|
-
.then((r) => {
|
|
406
|
+
beforeEach(() =>
|
|
407
|
+
webex.rooms.create({title: 'Webex Test Room'}).then((r) => {
|
|
376
408
|
room = r;
|
|
377
409
|
assert.property(room, 'id');
|
|
378
|
-
})
|
|
410
|
+
})
|
|
411
|
+
);
|
|
379
412
|
|
|
380
|
-
it('deletes a single room', () =>
|
|
381
|
-
.
|
|
382
|
-
|
|
413
|
+
it('deletes a single room', () =>
|
|
414
|
+
webex.rooms
|
|
415
|
+
.remove(room)
|
|
416
|
+
.then((body) => {
|
|
417
|
+
assert.notOk(body);
|
|
383
418
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
419
|
+
return assert.isRejected(webex.rooms.get(room));
|
|
420
|
+
})
|
|
421
|
+
.then((reason) => {
|
|
422
|
+
assert.instanceOf(reason, WebexHttpError.NotFound);
|
|
423
|
+
}));
|
|
389
424
|
});
|
|
390
425
|
});
|
|
391
426
|
});
|
|
@@ -398,26 +433,19 @@ describe('plugin-rooms', function () {
|
|
|
398
433
|
* @returns {void}
|
|
399
434
|
*/
|
|
400
435
|
function validateRoomEvent(event, room, actor) {
|
|
401
|
-
assert.isTrue(event.resource === SDK_EVENT.EXTERNAL.RESOURCE.ROOMS,
|
|
402
|
-
'not a room event');
|
|
436
|
+
assert.isTrue(event.resource === SDK_EVENT.EXTERNAL.RESOURCE.ROOMS, 'not a room event');
|
|
403
437
|
assert.isDefined(event.event, 'room event type not set');
|
|
404
438
|
assert.isDefined(event.created, 'event listener created date not set');
|
|
405
|
-
assert.equal(event.createdBy, actor.id,
|
|
406
|
-
|
|
407
|
-
assert.equal(event.orgId, actor.orgId,
|
|
408
|
-
'event listener orgId not === to our actor\'s');
|
|
439
|
+
assert.equal(event.createdBy, actor.id, 'event listener createdBy not set to our actor');
|
|
440
|
+
assert.equal(event.orgId, actor.orgId, "event listener orgId not === to our actor's");
|
|
409
441
|
assert.equal(event.ownedBy, 'creator', 'event listener not owned by creator');
|
|
410
442
|
assert.equal(event.status, 'active', 'event listener status not active');
|
|
411
|
-
assert.equal(event.actorId, actor.id,
|
|
412
|
-
'event actorId not equal to our actor\'s id');
|
|
443
|
+
assert.equal(event.actorId, actor.id, "event actorId not equal to our actor's id");
|
|
413
444
|
|
|
414
445
|
// Ensure event data matches data returned from function call
|
|
415
446
|
// Skip this until we figure out how conversations converts the internal test user UUID
|
|
416
|
-
assert.equal(event.data.id, room.id,
|
|
417
|
-
|
|
418
|
-
assert.equal(event.data.
|
|
419
|
-
'event/room.isLocked not equal');
|
|
420
|
-
assert.equal(event.data.type, room.type,
|
|
421
|
-
'event/room.type not equal');
|
|
447
|
+
assert.equal(event.data.id, room.id, 'event/room.id not equal');
|
|
448
|
+
assert.equal(event.data.isLocked, room.isLocked, 'event/room.isLocked not equal');
|
|
449
|
+
assert.equal(event.data.type, room.type, 'event/room.type not equal');
|
|
422
450
|
debug(`rooms:${event.event} event validated`);
|
|
423
451
|
}
|