@webex/plugin-meetings 3.0.0-beta.169 → 3.0.0-beta.170

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.
@@ -1,231 +1,307 @@
1
1
  import RecordingController from '@webex/plugin-meetings/src/recording-controller';
2
2
  import sinon from 'sinon';
3
3
  import {assert} from '@webex/test-helper-chai';
4
- import { HTTP_VERBS } from '@webex/plugin-meetings/src/constants';
4
+ import {HTTP_VERBS, SELF_POLICY} from '@webex/plugin-meetings/src/constants';
5
+
5
6
 
6
7
  describe('plugin-meetings', () => {
7
- describe('recording-controller tests', () => {
8
- describe('index', () => {
9
- let request;
10
-
11
- describe('class tests', () => {
12
- it('can set and extract new values later on', () => {
13
- const controller = new RecordingController({});
14
- assert.isUndefined(controller.getServiceUrl());
15
- assert.isUndefined(controller.getSessionId());
16
- assert.isUndefined(controller.getLocusUrl());
17
- assert.isUndefined(controller.getLocusId());
18
- controller.set({
19
- serviceUrl: 'test',
20
- sessionId: 'testId',
21
- locusUrl: 'test/id',
22
- displayHints: [],
23
- })
24
- assert(controller.getServiceUrl(), 'test');
25
- assert(controller.getSessionId(), 'testId');
26
- assert(controller.getLocusUrl(), 'test/id');
27
- assert(controller.getLocusId(), 'id');
28
- });
8
+ describe('recording-controller tests', () => {
9
+ describe('index', () => {
10
+ let request;
11
+
12
+ describe('class tests', () => {
13
+ it('can set and extract new values later on', () => {
14
+ const controller = new RecordingController({});
15
+ assert.isUndefined(controller.getServiceUrl());
16
+ assert.isUndefined(controller.getSessionId());
17
+ assert.isUndefined(controller.getLocusUrl());
18
+ assert.isUndefined(controller.getLocusId());
19
+ controller.set({
20
+ serviceUrl: 'test',
21
+ sessionId: 'testId',
22
+ locusUrl: 'test/id',
23
+ displayHints: [],
24
+ });
25
+ assert(controller.getServiceUrl(), 'test');
26
+ assert(controller.getSessionId(), 'testId');
27
+ assert(controller.getLocusUrl(), 'test/id');
28
+ assert(controller.getLocusId(), 'id');
29
+ });
30
+ });
31
+
32
+ describe('legacy locus style recording', () => {
33
+ const locusUrl = 'locusUrl';
34
+ let controller;
35
+
36
+ beforeEach(() => {
37
+ request = {
38
+ request: sinon.stub().returns(Promise.resolve()),
39
+ };
40
+
41
+ controller = new RecordingController(request);
42
+
43
+ controller.set({
44
+ locusUrl,
45
+ displayHints: [],
46
+ });
47
+ });
48
+
49
+ describe('startRecording', () => {
50
+ it('rejects when correct display hint is not present', () => {
51
+ const result = controller.startRecording();
52
+
53
+ assert.notCalled(request.request);
54
+
55
+ assert.isRejected(result);
56
+ });
57
+
58
+ it('rejects when correct display hint is present but the policy is false', () => {
59
+ controller.setDisplayHints(['RECORDING_CONTROL_START']);
60
+ controller.setUserPolicy({[SELF_POLICY.SUPPORT_NETWORK_BASED_RECORD]: false});
61
+ const result = controller.startRecording();
62
+
63
+ assert.notCalled(request.request);
64
+
65
+ assert.isRejected(result);
66
+ });
67
+
68
+ it('can start recording when the correct display hint is present', () => {
69
+ controller.setDisplayHints(['RECORDING_CONTROL_START']);
70
+
71
+ const result = controller.startRecording();
72
+
73
+ assert.calledWith(request.request, {
74
+ uri: `${locusUrl}/controls`,
75
+ body: {record: {recording: true, paused: false}},
76
+ method: HTTP_VERBS.PATCH,
29
77
  });
30
78
 
79
+ assert.deepEqual(result, request.request.firstCall.returnValue);
80
+ });
81
+ });
82
+
83
+ describe('stopRecording', () => {
84
+ it('rejects when correct display hint is not present', () => {
85
+ const result = controller.stopRecording();
31
86
 
32
- describe('legacy locus style recording', () => {
33
- const locusUrl = 'locusUrl';
34
- let controller;
35
-
36
- beforeEach(() => {
37
- request = {
38
- request: sinon.stub().returns(Promise.resolve()),
39
- };
40
-
41
- controller = new RecordingController(request);
42
-
43
- controller.set({
44
- locusUrl,
45
- displayHints: [],
46
- })
47
-
48
- });
49
-
50
- describe('startRecording', () => {
51
- it('rejects when correct display hint is not present', () => {
52
- const result = controller.startRecording();
53
-
54
- assert.notCalled(request.request);
55
-
56
- assert.isRejected(result);
57
- });
58
-
59
- it('can start recording when the correct display hint is present', () => {
60
- controller.setDisplayHints(['RECORDING_CONTROL_START']);
61
-
62
- const result = controller.startRecording();
63
-
64
- assert.calledWith(request.request, {uri: `${locusUrl}/controls`, body: {record: {recording: true, paused: false}}, method: HTTP_VERBS.PATCH});
65
-
66
- assert.deepEqual(result, request.request.firstCall.returnValue);
67
- });
68
- });
69
-
70
- describe('stopRecording', () => {
71
- it('rejects when correct display hint is not present', () => {
72
- const result = controller.stopRecording();
73
-
74
- assert.notCalled(request.request);
75
-
76
- assert.isRejected(result);
77
- });
78
-
79
- it('can stop recording when the correct display hint is present', () => {
80
- controller.setDisplayHints(['RECORDING_CONTROL_STOP']);
81
-
82
- const result = controller.stopRecording();
83
-
84
- assert.calledWith(request.request, {uri: `${locusUrl}/controls`, body: {record: {recording: false, paused: false}}, method: HTTP_VERBS.PATCH});
85
-
86
- assert.deepEqual(result, request.request.firstCall.returnValue);
87
- });
88
- });
89
-
90
- describe('pauseRecording', () => {
91
- it('rejects when correct display hint is not present', () => {
92
- const result = controller.pauseRecording();
93
-
94
- assert.notCalled(request.request);
95
-
96
- assert.isRejected(result);
97
- });
98
-
99
- it('can pause recording when the correct display hint is present', () => {
100
- controller.setDisplayHints(['RECORDING_CONTROL_PAUSE']);
101
-
102
- const result = controller.pauseRecording();
103
-
104
- assert.calledWith(request.request, {uri: `${locusUrl}/controls`, body: {record: {recording: true, paused: true}}, method: HTTP_VERBS.PATCH});
105
-
106
- assert.deepEqual(result, request.request.firstCall.returnValue);
107
- });
108
- });
109
-
110
- describe('resumeRecording', () => {
111
- it('rejects when correct display hint is not present', () => {
112
- const result = controller.pauseRecording();
113
-
114
- assert.notCalled(request.request);
115
-
116
- assert.isRejected(result);
117
- });
118
-
119
- it('can resume recording when the correct display hint is present', () => {
120
- controller.setDisplayHints(['RECORDING_CONTROL_RESUME']);
121
-
122
- const result = controller.resumeRecording();
123
-
124
- assert.calledWith(request.request, {uri: `${locusUrl}/controls`, body: {record: {recording: true, paused: false}}, method: HTTP_VERBS.PATCH});
125
-
126
- assert.deepEqual(result, request.request.firstCall.returnValue);
127
- });
128
- });
87
+ assert.notCalled(request.request);
88
+
89
+ assert.isRejected(result);
90
+ });
91
+
92
+ it('rejects when correct display hint is present but the policy is false', () => {
93
+ controller.setDisplayHints(['RECORDING_CONTROL_STOP']);
94
+ controller.setUserPolicy({[SELF_POLICY.SUPPORT_NETWORK_BASED_RECORD]: false})
95
+ const result = controller.stopRecording();
96
+
97
+ assert.notCalled(request.request);
98
+
99
+ assert.isRejected(result);
100
+ });
101
+
102
+ it('can stop recording when the correct display hint is present', () => {
103
+ controller.setDisplayHints(['RECORDING_CONTROL_STOP']);
104
+
105
+ const result = controller.stopRecording();
106
+
107
+ assert.calledWith(request.request, {
108
+ uri: `${locusUrl}/controls`,
109
+ body: {record: {recording: false, paused: false}},
110
+ method: HTTP_VERBS.PATCH,
111
+ });
112
+
113
+ assert.deepEqual(result, request.request.firstCall.returnValue);
114
+ });
115
+ });
116
+
117
+ describe('pauseRecording', () => {
118
+ it('rejects when correct display hint is not present', () => {
119
+ const result = controller.pauseRecording();
120
+
121
+ assert.notCalled(request.request);
122
+
123
+ assert.isRejected(result);
124
+ });
125
+
126
+ it('rejects when correct display hint is present but the policy is false', () => {
127
+ controller.setDisplayHints(['RECORDING_CONTROL_PAUSE']);
128
+ controller.setUserPolicy({
129
+ [SELF_POLICY.SUPPORT_NETWORK_BASED_RECORD]: false,
130
+ });
131
+ const result = controller.pauseRecording();
132
+
133
+ assert.notCalled(request.request);
134
+
135
+ assert.isRejected(result);
136
+ });
137
+
138
+ it('can pause recording when the correct display hint is present', () => {
139
+ controller.setDisplayHints(['RECORDING_CONTROL_PAUSE']);
140
+
141
+ const result = controller.pauseRecording();
142
+
143
+ assert.calledWith(request.request, {
144
+ uri: `${locusUrl}/controls`,
145
+ body: {record: {recording: true, paused: true}},
146
+ method: HTTP_VERBS.PATCH,
129
147
  });
130
148
 
131
- describe('recording streaming service style tests', () => {
132
- let controller;
133
-
134
- beforeEach(() => {
135
- request = {
136
- request: sinon.stub().returns(Promise.resolve()),
137
- };
138
-
139
- controller = new RecordingController(request);
140
-
141
- controller.set({
142
- serviceUrl: 'test',
143
- sessionId: 'testId',
144
- locusUrl: 'test/id',
145
- displayHints: [],
146
- })
147
- });
148
-
149
- describe('startRecording', () => {
150
- it('rejects when correct display hint is not present', () => {
151
- const result = controller.startRecording();
152
-
153
- assert.notCalled(request.request);
154
-
155
- assert.isRejected(result);
156
- });
157
-
158
- it('can start recording when the correct display hint is present', () => {
159
- controller.setDisplayHints(['RECORDING_CONTROL_START']);
160
-
161
- const result = controller.startRecording();
162
-
163
- assert.calledWith(request.request, {uri: `test/loci/id/recording`, body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'start'}}, method: HTTP_VERBS.PUT});
164
-
165
- assert.deepEqual(result, request.request.firstCall.returnValue);
166
- });
167
- });
168
-
169
- describe('stopRecording', () => {
170
- it('rejects when correct display hint is not present', () => {
171
- const result = controller.pauseRecording();
172
-
173
- assert.notCalled(request.request);
174
-
175
- assert.isRejected(result);
176
- });
177
-
178
- it('can start recording when the correct display hint is present', () => {
179
- controller.setDisplayHints(['RECORDING_CONTROL_STOP']);
180
-
181
- const result = controller.stopRecording();
182
-
183
- assert.calledWith(request.request, {uri: `test/loci/id/recording`, body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'stop'}}, method: HTTP_VERBS.PUT});
184
-
185
- assert.deepEqual(result, request.request.firstCall.returnValue);
186
- });
187
- });
188
-
189
- describe('pauseRecording', () => {
190
- it('rejects when correct display hint is not present', () => {
191
- const result = controller.pauseRecording();
192
-
193
- assert.notCalled(request.request);
194
-
195
- assert.isRejected(result);
196
- });
197
-
198
- it('can pause recording when the correct display hint is present', () => {
199
- controller.setDisplayHints(['RECORDING_CONTROL_PAUSE']);
200
-
201
- const result = controller.pauseRecording();
202
-
203
- assert.calledWith(request.request, {uri: `test/loci/id/recording`, body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'pause'}}, method: HTTP_VERBS.PUT});
204
-
205
- assert.deepEqual(result, request.request.firstCall.returnValue);
206
- });
207
- });
208
-
209
- describe('resumeRecording', () => {
210
- it('rejects when correct display hint is not present', () => {
211
- const result = controller.resumeRecording();
212
-
213
- assert.notCalled(request.request);
214
-
215
- assert.isRejected(result);
216
- });
217
-
218
- it('can resume recording when the correct display hint is present', () => {
219
- controller.setDisplayHints(['RECORDING_CONTROL_RESUME']);
220
-
221
- const result = controller.resumeRecording();
222
-
223
- assert.calledWith(request.request, {uri: `test/loci/id/recording`, body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'resume'}}, method: HTTP_VERBS.PUT});
224
-
225
- assert.deepEqual(result, request.request.firstCall.returnValue);
226
- });
227
- });
149
+ assert.deepEqual(result, request.request.firstCall.returnValue);
150
+ });
151
+ });
152
+
153
+ describe('resumeRecording', () => {
154
+ it('rejects when correct display hint is not present', () => {
155
+ const result = controller.pauseRecording();
156
+
157
+ assert.notCalled(request.request);
158
+
159
+ assert.isRejected(result);
160
+ });
161
+
162
+ it('rejects when correct display hint is present but the policy is false', () => {
163
+ controller.setDisplayHints(['RECORDING_CONTROL_RESUME']);
164
+ controller.setUserPolicy({
165
+ [SELF_POLICY.SUPPORT_NETWORK_BASED_RECORD]: false,
228
166
  });
167
+ const result = controller.pauseRecording();
168
+
169
+ assert.notCalled(request.request);
170
+
171
+ assert.isRejected(result);
172
+ });
173
+
174
+
175
+ it('can resume recording when the correct display hint is present', () => {
176
+ controller.setDisplayHints(['RECORDING_CONTROL_RESUME']);
177
+
178
+ const result = controller.resumeRecording();
179
+
180
+ assert.calledWith(request.request, {
181
+ uri: `${locusUrl}/controls`,
182
+ body: {record: {recording: true, paused: false}},
183
+ method: HTTP_VERBS.PATCH,
184
+ });
185
+
186
+ assert.deepEqual(result, request.request.firstCall.returnValue);
187
+ });
188
+ });
189
+ });
190
+
191
+ describe('recording streaming service style tests', () => {
192
+ let controller;
193
+
194
+ beforeEach(() => {
195
+ request = {
196
+ request: sinon.stub().returns(Promise.resolve()),
197
+ };
198
+
199
+ controller = new RecordingController(request);
200
+
201
+ controller.set({
202
+ serviceUrl: 'test',
203
+ sessionId: 'testId',
204
+ locusUrl: 'test/id',
205
+ displayHints: [],
206
+ });
207
+ });
208
+
209
+ describe('startRecording', () => {
210
+ it('rejects when correct display hint is not present', () => {
211
+ const result = controller.startRecording();
212
+
213
+ assert.notCalled(request.request);
214
+
215
+ assert.isRejected(result);
216
+ });
217
+
218
+ it('can start recording when the correct display hint is present', () => {
219
+ controller.setDisplayHints(['RECORDING_CONTROL_START']);
220
+
221
+ const result = controller.startRecording();
222
+
223
+ assert.calledWith(request.request, {
224
+ uri: `test/loci/id/recording`,
225
+ body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'start'}},
226
+ method: HTTP_VERBS.PUT,
227
+ });
228
+
229
+ assert.deepEqual(result, request.request.firstCall.returnValue);
230
+ });
231
+ });
232
+
233
+ describe('stopRecording', () => {
234
+ it('rejects when correct display hint is not present', () => {
235
+ const result = controller.pauseRecording();
236
+
237
+ assert.notCalled(request.request);
238
+
239
+ assert.isRejected(result);
240
+ });
241
+
242
+ it('can start recording when the correct display hint is present', () => {
243
+ controller.setDisplayHints(['RECORDING_CONTROL_STOP']);
244
+
245
+ const result = controller.stopRecording();
246
+
247
+ assert.calledWith(request.request, {
248
+ uri: `test/loci/id/recording`,
249
+ body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'stop'}},
250
+ method: HTTP_VERBS.PUT,
251
+ });
252
+
253
+ assert.deepEqual(result, request.request.firstCall.returnValue);
254
+ });
255
+ });
256
+
257
+ describe('pauseRecording', () => {
258
+ it('rejects when correct display hint is not present', () => {
259
+ const result = controller.pauseRecording();
260
+
261
+ assert.notCalled(request.request);
262
+
263
+ assert.isRejected(result);
264
+ });
265
+
266
+ it('can pause recording when the correct display hint is present', () => {
267
+ controller.setDisplayHints(['RECORDING_CONTROL_PAUSE']);
268
+
269
+ const result = controller.pauseRecording();
270
+
271
+ assert.calledWith(request.request, {
272
+ uri: `test/loci/id/recording`,
273
+ body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'pause'}},
274
+ method: HTTP_VERBS.PUT,
275
+ });
276
+
277
+ assert.deepEqual(result, request.request.firstCall.returnValue);
278
+ });
279
+ });
280
+
281
+ describe('resumeRecording', () => {
282
+ it('rejects when correct display hint is not present', () => {
283
+ const result = controller.resumeRecording();
284
+
285
+ assert.notCalled(request.request);
286
+
287
+ assert.isRejected(result);
288
+ });
289
+
290
+ it('can resume recording when the correct display hint is present', () => {
291
+ controller.setDisplayHints(['RECORDING_CONTROL_RESUME']);
292
+
293
+ const result = controller.resumeRecording();
294
+
295
+ assert.calledWith(request.request, {
296
+ uri: `test/loci/id/recording`,
297
+ body: {meetingInfo: {locusSessionId: 'testId'}, recording: {action: 'resume'}},
298
+ method: HTTP_VERBS.PUT,
299
+ });
300
+
301
+ assert.deepEqual(result, request.request.firstCall.returnValue);
229
302
  });
303
+ });
304
+ });
230
305
  });
231
- });
306
+ });
307
+ });