@webex/plugin-meetings 3.0.0-beta.39 → 3.0.0-beta.40
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/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +111 -23
- package/dist/breakouts/index.js.map +1 -1
- package/dist/breakouts/utils.js +26 -1
- package/dist/breakouts/utils.js.map +1 -1
- package/dist/constants.js +7 -2
- package/dist/constants.js.map +1 -1
- package/dist/members/index.js +2 -1
- package/dist/members/index.js.map +1 -1
- package/dist/types/breakouts/utils.d.ts +7 -0
- package/dist/types/constants.d.ts +6 -1
- package/package.json +18 -18
- package/src/breakouts/README.md +8 -5
- package/src/breakouts/index.ts +100 -22
- package/src/breakouts/utils.ts +24 -0
- package/src/constants.ts +6 -1
- package/src/members/index.ts +1 -1
- package/test/unit/spec/breakouts/index.ts +187 -35
- package/test/unit/spec/breakouts/utils.js +27 -1
|
@@ -1,14 +1,52 @@
|
|
|
1
1
|
import {assert, expect} from '@webex/test-helper-chai';
|
|
2
|
-
import Breakout from '@webex/plugin-meetings/src/breakouts/breakout';
|
|
3
2
|
import Breakouts from '@webex/plugin-meetings/src/breakouts';
|
|
4
|
-
import BreakoutCollection from '@webex/plugin-meetings/src/breakouts/collection';
|
|
5
3
|
import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
|
|
6
4
|
import {BREAKOUTS} from '@webex/plugin-meetings/src/constants';
|
|
7
|
-
import sinon from
|
|
5
|
+
import sinon from 'sinon';
|
|
8
6
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
9
7
|
import testUtils from '../../../utils/testUtils';
|
|
10
8
|
import BreakoutEditLockedError from "@webex/plugin-meetings/src/breakouts/edit-lock-error";
|
|
11
9
|
|
|
10
|
+
const getBOResponse = (status: string) => {
|
|
11
|
+
return {
|
|
12
|
+
url: 'url',
|
|
13
|
+
locusUrl: 'locusUrl',
|
|
14
|
+
mainGroupId: 'mainGroupId',
|
|
15
|
+
mainSessionId: 'mainSessionId',
|
|
16
|
+
groups: [
|
|
17
|
+
{
|
|
18
|
+
id: 'groupId',
|
|
19
|
+
type: 'BREAKOUT',
|
|
20
|
+
status,
|
|
21
|
+
duration: 60000,
|
|
22
|
+
durationSetting: 60000,
|
|
23
|
+
delayCloseTime: 60,
|
|
24
|
+
allowBackToMain: true,
|
|
25
|
+
allowToJoinLater: true,
|
|
26
|
+
startTime: '2023-02-01T23:08:43.200Z',
|
|
27
|
+
sessions: [
|
|
28
|
+
{
|
|
29
|
+
name: 'Breakout Session 1',
|
|
30
|
+
subConfId: 1,
|
|
31
|
+
anyoneCanJoin: false,
|
|
32
|
+
locusUrl: 'locusUrl',
|
|
33
|
+
venueUrl: 'venueUrl',
|
|
34
|
+
allowed: ['allowed id1', 'allowed id2'],
|
|
35
|
+
id: 'sessionId1',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Breakout Session 2',
|
|
39
|
+
anyoneCanJoin: true,
|
|
40
|
+
locusUrl: 'locusUrl',
|
|
41
|
+
allowed: ['allowed id3', 'allowed id4'],
|
|
42
|
+
id: 'sessionId2',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
12
50
|
describe('plugin-meetings', () => {
|
|
13
51
|
describe('Breakouts', () => {
|
|
14
52
|
let webex;
|
|
@@ -43,7 +81,7 @@ describe('plugin-meetings', () => {
|
|
|
43
81
|
|
|
44
82
|
assert.isFalse(called);
|
|
45
83
|
|
|
46
|
-
breakouts.set({
|
|
84
|
+
breakouts.set({status: BREAKOUTS.STATUS.CLOSING});
|
|
47
85
|
|
|
48
86
|
assert.isTrue(called);
|
|
49
87
|
});
|
|
@@ -67,7 +105,7 @@ describe('plugin-meetings', () => {
|
|
|
67
105
|
|
|
68
106
|
breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.MESSAGE, (event) => {
|
|
69
107
|
message = event;
|
|
70
|
-
})
|
|
108
|
+
});
|
|
71
109
|
|
|
72
110
|
breakouts.currentBreakoutSession.sessionId = 'sessionId';
|
|
73
111
|
|
|
@@ -76,14 +114,14 @@ describe('plugin-meetings', () => {
|
|
|
76
114
|
senderUserId: 'senderUserId',
|
|
77
115
|
sentTime: 'sentTime',
|
|
78
116
|
message: 'message',
|
|
79
|
-
}
|
|
117
|
+
},
|
|
80
118
|
});
|
|
81
119
|
|
|
82
120
|
assert.deepEqual(message, {
|
|
83
|
-
senderUserId:
|
|
121
|
+
senderUserId: 'senderUserId',
|
|
84
122
|
sentTime: 'sentTime',
|
|
85
123
|
message: 'message',
|
|
86
|
-
sessionId: 'sessionId'
|
|
124
|
+
sessionId: 'sessionId',
|
|
87
125
|
});
|
|
88
126
|
});
|
|
89
127
|
});
|
|
@@ -99,13 +137,13 @@ describe('plugin-meetings', () => {
|
|
|
99
137
|
|
|
100
138
|
breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.MEMBERS_UPDATE, () => {
|
|
101
139
|
called = true;
|
|
102
|
-
})
|
|
140
|
+
});
|
|
103
141
|
breakouts.handleRosterUpdate = sinon.stub();
|
|
104
142
|
|
|
105
143
|
callback({
|
|
106
144
|
data: {
|
|
107
|
-
locus: 'locus'
|
|
108
|
-
}
|
|
145
|
+
locus: 'locus',
|
|
146
|
+
},
|
|
109
147
|
});
|
|
110
148
|
|
|
111
149
|
assert.isTrue(called);
|
|
@@ -126,7 +164,7 @@ describe('plugin-meetings', () => {
|
|
|
126
164
|
enableBreakoutSession: true,
|
|
127
165
|
startTime: 'startTime',
|
|
128
166
|
status: 'active',
|
|
129
|
-
locusUrl: 'locusUrl'
|
|
167
|
+
locusUrl: 'locusUrl',
|
|
130
168
|
});
|
|
131
169
|
|
|
132
170
|
assert.equal(breakouts.allowBackToMain, true);
|
|
@@ -155,7 +193,6 @@ describe('plugin-meetings', () => {
|
|
|
155
193
|
});
|
|
156
194
|
|
|
157
195
|
describe('#updateBreakoutSessions', () => {
|
|
158
|
-
|
|
159
196
|
const checkBreakout = (breakout, sessionId, state) => {
|
|
160
197
|
assert.deepEqual(breakout.attributes, {
|
|
161
198
|
active: false,
|
|
@@ -167,12 +204,11 @@ describe('plugin-meetings', () => {
|
|
|
167
204
|
requested: false,
|
|
168
205
|
url: 'url',
|
|
169
206
|
sessionId,
|
|
170
|
-
...{[state]: true}
|
|
207
|
+
...{[state]: true},
|
|
171
208
|
});
|
|
172
|
-
}
|
|
209
|
+
};
|
|
173
210
|
|
|
174
211
|
it('works', () => {
|
|
175
|
-
|
|
176
212
|
breakouts.set('url', 'url');
|
|
177
213
|
|
|
178
214
|
const payload = {
|
|
@@ -182,8 +218,8 @@ describe('plugin-meetings', () => {
|
|
|
182
218
|
allowed: [{sessionId: 'sessionId3'}],
|
|
183
219
|
assignedCurrent: [{sessionId: 'sessionId4'}],
|
|
184
220
|
requested: [{sessionId: 'sessionId5'}],
|
|
185
|
-
}
|
|
186
|
-
}
|
|
221
|
+
},
|
|
222
|
+
};
|
|
187
223
|
|
|
188
224
|
breakouts.updateBreakoutSessions(payload);
|
|
189
225
|
|
|
@@ -192,7 +228,7 @@ describe('plugin-meetings', () => {
|
|
|
192
228
|
checkBreakout(breakouts.breakouts.get('sessionId3'), 'sessionId3', 'allowed');
|
|
193
229
|
checkBreakout(breakouts.breakouts.get('sessionId4'), 'sessionId4', 'assignedCurrent');
|
|
194
230
|
checkBreakout(breakouts.breakouts.get('sessionId5'), 'sessionId5', 'requested');
|
|
195
|
-
})
|
|
231
|
+
});
|
|
196
232
|
});
|
|
197
233
|
|
|
198
234
|
describe('#locusUrlUpdate', () => {
|
|
@@ -224,7 +260,7 @@ describe('plugin-meetings', () => {
|
|
|
224
260
|
const breakout = breakouts.breakouts.models[0];
|
|
225
261
|
breakout.parseRoster = sinon.stub();
|
|
226
262
|
|
|
227
|
-
const locus = {controls: {breakout: {sessionId: 'sessionId'}}}
|
|
263
|
+
const locus = {controls: {breakout: {sessionId: 'sessionId'}}};
|
|
228
264
|
|
|
229
265
|
breakouts.handleRosterUpdate(locus);
|
|
230
266
|
assert.calledOnceWithExactly(breakout.parseRoster, locus);
|
|
@@ -232,18 +268,21 @@ describe('plugin-meetings', () => {
|
|
|
232
268
|
});
|
|
233
269
|
|
|
234
270
|
describe('#queryRosters', () => {
|
|
235
|
-
|
|
236
271
|
it('makes the expected query', async () => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
272
|
+
webex.request.returns(
|
|
273
|
+
Promise.resolve({
|
|
274
|
+
body: {
|
|
275
|
+
rosters: [
|
|
276
|
+
{
|
|
277
|
+
locus: 'locus1',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
locus: 'locus2',
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
})
|
|
285
|
+
);
|
|
247
286
|
|
|
248
287
|
breakouts.set('url', 'url');
|
|
249
288
|
breakouts.set('locusUrl', 'test');
|
|
@@ -254,7 +293,7 @@ describe('plugin-meetings', () => {
|
|
|
254
293
|
|
|
255
294
|
assert.calledOnceWithExactly(webex.request, {
|
|
256
295
|
uri: 'url/roster',
|
|
257
|
-
qs: {
|
|
296
|
+
qs: {locusUrl: 'dGVzdA=='},
|
|
258
297
|
});
|
|
259
298
|
assert.calledTwice(breakouts.handleRosterUpdate);
|
|
260
299
|
|
|
@@ -263,7 +302,7 @@ describe('plugin-meetings', () => {
|
|
|
263
302
|
});
|
|
264
303
|
|
|
265
304
|
it('logs the error if the query fails', async () => {
|
|
266
|
-
const error = new Error('something went wrong')
|
|
305
|
+
const error = new Error('something went wrong');
|
|
267
306
|
webex.request.rejects(error);
|
|
268
307
|
LoggerProxy.logger.error = sinon.stub();
|
|
269
308
|
|
|
@@ -290,7 +329,7 @@ describe('plugin-meetings', () => {
|
|
|
290
329
|
describe('isInMainSession', () => {
|
|
291
330
|
it('returns true when sessionType is MAIN', () => {
|
|
292
331
|
assert.equal(breakouts.isInMainSession, false);
|
|
293
|
-
breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN)
|
|
332
|
+
breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
|
|
294
333
|
assert.equal(breakouts.isInMainSession, true);
|
|
295
334
|
});
|
|
296
335
|
});
|
|
@@ -417,6 +456,12 @@ describe('plugin-meetings', () => {
|
|
|
417
456
|
describe('#broadcast', () => {
|
|
418
457
|
it('makes the request as expected', async () => {
|
|
419
458
|
breakouts.breakoutRequest.broadcast = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
|
|
459
|
+
webex.request.returns(
|
|
460
|
+
Promise.resolve({
|
|
461
|
+
body: getBOResponse('OPEN'),
|
|
462
|
+
})
|
|
463
|
+
);
|
|
464
|
+
await breakouts.getBreakout();
|
|
420
465
|
let result = await breakouts.broadcast('hello');
|
|
421
466
|
assert.calledWithExactly(breakouts.breakoutRequest.broadcast, {
|
|
422
467
|
url: 'url',
|
|
@@ -446,6 +491,113 @@ describe('plugin-meetings', () => {
|
|
|
446
491
|
});
|
|
447
492
|
});
|
|
448
493
|
|
|
494
|
+
describe('#start', () => {
|
|
495
|
+
it('should start breakout sessions', async () => {
|
|
496
|
+
webex.request.returns(
|
|
497
|
+
Promise.resolve({
|
|
498
|
+
body: getBOResponse('OPEN'),
|
|
499
|
+
})
|
|
500
|
+
);
|
|
501
|
+
|
|
502
|
+
breakouts.set('url', 'url');
|
|
503
|
+
await breakouts.getBreakout();
|
|
504
|
+
|
|
505
|
+
const result = await breakouts.start();
|
|
506
|
+
await breakouts.start({id: 'id', someOtherParam: 'someOtherParam'});
|
|
507
|
+
|
|
508
|
+
const arg = webex.request.getCall(1).args[0];
|
|
509
|
+
const argObj1 = arg.body.groups[0];
|
|
510
|
+
const argObj2 = webex.request.getCall(2).args[0].body.groups[0];
|
|
511
|
+
|
|
512
|
+
assert.equal(arg.uri, 'url');
|
|
513
|
+
assert.equal(arg.method, 'PUT');
|
|
514
|
+
assert.deepEqual(argObj1, {id:'groupId', action: 'START', allowBackToMain: false, allowToJoinLater: false});
|
|
515
|
+
assert.deepEqual(argObj2, {id:'id', action: 'START', allowBackToMain: false, allowToJoinLater: false, someOtherParam: 'someOtherParam'});
|
|
516
|
+
assert.deepEqual(result, {body: getBOResponse('OPEN')});
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
it('rejects when edit lock token mismatch', async () => {
|
|
520
|
+
webex.request.returns(Promise.reject({
|
|
521
|
+
body: {
|
|
522
|
+
"errorCode":BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
|
|
523
|
+
"message":"Edit lock token mismatch"
|
|
524
|
+
}
|
|
525
|
+
}));
|
|
526
|
+
|
|
527
|
+
await assert.isRejected(
|
|
528
|
+
breakouts.start(),
|
|
529
|
+
BreakoutEditLockedError,
|
|
530
|
+
'Edit lock token mismatch'
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
describe('#end', () => {
|
|
537
|
+
it('should end breakout sessions', async () => {
|
|
538
|
+
webex.request.returns(
|
|
539
|
+
Promise.resolve({
|
|
540
|
+
body: getBOResponse('CLOSING'),
|
|
541
|
+
})
|
|
542
|
+
);
|
|
543
|
+
|
|
544
|
+
breakouts.set('url', 'url');
|
|
545
|
+
breakouts.set('delayCloseTime', 60);
|
|
546
|
+
await breakouts.getBreakout();
|
|
547
|
+
|
|
548
|
+
const result = await breakouts.end();
|
|
549
|
+
await breakouts.end({id: 'id', someOtherParam: 'someOtherParam'});
|
|
550
|
+
const arg = webex.request.getCall(1).args[0];
|
|
551
|
+
const argObj1 = arg.body.groups[0];
|
|
552
|
+
const argObj2 = webex.request.getCall(2).args[0].body.groups[0];
|
|
553
|
+
|
|
554
|
+
assert.equal(arg.uri, 'url');
|
|
555
|
+
assert.equal(arg.method, 'PUT');
|
|
556
|
+
assert.deepEqual(argObj1, {id:'groupId', action: 'CLOSE', delayCloseTime: 60});
|
|
557
|
+
assert.deepEqual(argObj2, {id:'id', action: 'CLOSE', delayCloseTime: 60, someOtherParam: 'someOtherParam'});
|
|
558
|
+
assert.deepEqual(result, {body: getBOResponse('CLOSING')});
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
it('rejects when edit lock token mismatch', async () => {
|
|
562
|
+
webex.request.returns(Promise.reject({
|
|
563
|
+
body: {
|
|
564
|
+
"errorCode":BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
|
|
565
|
+
"message":"Edit lock token mismatch"
|
|
566
|
+
}
|
|
567
|
+
}));
|
|
568
|
+
|
|
569
|
+
await assert.isRejected(
|
|
570
|
+
breakouts.end(),
|
|
571
|
+
BreakoutEditLockedError,
|
|
572
|
+
'Edit lock token mismatch'
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
describe('#getBreakout', () => {
|
|
579
|
+
it('should get breakout sessions', async () => {
|
|
580
|
+
webex.request.returns(
|
|
581
|
+
Promise.resolve({
|
|
582
|
+
body: getBOResponse('PENDING'),
|
|
583
|
+
})
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
breakouts.set('url', 'url');
|
|
587
|
+
const result = await breakouts.getBreakout();
|
|
588
|
+
await breakouts.getBreakout(true);
|
|
589
|
+
const arg1 = webex.request.getCall(0).args[0];
|
|
590
|
+
const arg2 = webex.request.getCall(1).args[0];
|
|
591
|
+
|
|
592
|
+
assert.equal(arg1.uri, 'url');
|
|
593
|
+
assert.equal(arg2.uri, 'url?editlock=true');
|
|
594
|
+
assert.equal(arg1.method, 'GET');
|
|
595
|
+
assert.deepEqual(result, {body: getBOResponse('PENDING')});
|
|
596
|
+
assert.deepEqual(breakouts.groups, result.body.groups);
|
|
597
|
+
assert.equal(breakouts.breakoutGroupId, 'groupId');
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
|
|
449
601
|
describe('doToggleBreakout', () => {
|
|
450
602
|
it('makes the request as expected', async () => {
|
|
451
603
|
const result = await breakouts.doToggleBreakout(true);
|
|
@@ -480,7 +632,7 @@ describe('plugin-meetings', () => {
|
|
|
480
632
|
body: {
|
|
481
633
|
groups: [
|
|
482
634
|
{
|
|
483
|
-
action: BREAKOUTS.
|
|
635
|
+
action: BREAKOUTS.ACTION.DELETE,
|
|
484
636
|
},
|
|
485
637
|
],
|
|
486
638
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {assert} from '@webex/test-helper-chai';
|
|
2
|
-
import {getBroadcastRoles} from '@webex/plugin-meetings/src/breakouts/utils'
|
|
2
|
+
import {getBroadcastRoles, boServiceErrorHandler} from '@webex/plugin-meetings/src/breakouts/utils';
|
|
3
|
+
import BreakoutEditLockedError from '../../../../src/breakouts/edit-lock-error';
|
|
4
|
+
import {BREAKOUTS} from '../../../../src/constants';
|
|
5
|
+
|
|
3
6
|
describe('plugin-meetings', () => {
|
|
4
7
|
describe('Breakouts utils', () => {
|
|
5
8
|
describe('#getBroadcastRoles', () => {
|
|
@@ -17,5 +20,28 @@ describe('plugin-meetings', () => {
|
|
|
17
20
|
assert.deepEqual(roles, ['COHOST', 'PRESENTER']);
|
|
18
21
|
});
|
|
19
22
|
});
|
|
23
|
+
describe('#boServiceErrorHandler', () => {
|
|
24
|
+
it('return handled breakout service errors', () => {
|
|
25
|
+
// normal error
|
|
26
|
+
const errorMessage = 'Something was wrong.';
|
|
27
|
+
let handledError = boServiceErrorHandler(new Error(errorMessage));
|
|
28
|
+
assert.deepEqual(handledError, handledError);
|
|
29
|
+
assert.equal(handledError.message, errorMessage);
|
|
30
|
+
|
|
31
|
+
// undefined
|
|
32
|
+
handledError = boServiceErrorHandler();
|
|
33
|
+
assert.equal(handledError, undefined);
|
|
34
|
+
|
|
35
|
+
//Edit lock token mismatch error
|
|
36
|
+
const tokenMismatchError = {
|
|
37
|
+
body: {errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH},
|
|
38
|
+
};
|
|
39
|
+
handledError = boServiceErrorHandler(tokenMismatchError);
|
|
40
|
+
assert.deepEqual(
|
|
41
|
+
handledError,
|
|
42
|
+
new BreakoutEditLockedError('Edit lock token mismatch', tokenMismatchError)
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
20
46
|
});
|
|
21
47
|
});
|