@webex/plugin-meetings 3.0.0-beta.34 → 3.0.0-beta.35
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 +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/meeting/request.js +135 -85
- package/dist/meeting/request.js.map +1 -1
- package/dist/reachability/index.js +25 -17
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/request.js +12 -5
- package/dist/reachability/request.js.map +1 -1
- package/dist/roap/request.js +114 -83
- package/dist/roap/request.js.map +1 -1
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/meeting/request.d.ts +10 -0
- package/dist/types/reachability/request.d.ts +5 -3
- package/dist/types/roap/request.d.ts +6 -3
- package/package.json +18 -18
- package/src/constants.ts +2 -1
- package/src/meeting/request.ts +35 -1
- package/src/reachability/index.ts +12 -4
- package/src/reachability/request.ts +10 -5
- package/src/roap/request.ts +93 -78
- package/test/unit/spec/meeting/request.js +27 -0
- package/test/unit/spec/reachability/index.ts +18 -7
- package/test/unit/spec/reachability/request.js +66 -0
- package/test/unit/spec/roap/request.ts +187 -84
|
@@ -1,114 +1,217 @@
|
|
|
1
|
-
import {assert} from '@webex/test-helper-chai';
|
|
2
1
|
import sinon from 'sinon';
|
|
2
|
+
import {assert} from '@webex/test-helper-chai';
|
|
3
3
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import Meetings from '@webex/plugin-meetings';
|
|
6
5
|
import RoapRequest from '@webex/plugin-meetings/src/roap/request';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
import Metrics from '@webex/plugin-meetings/src/metrics';
|
|
7
|
+
import {REACHABILITY} from '@webex/plugin-meetings/src/constants';
|
|
8
|
+
|
|
9
|
+
describe('plugin-meetings/roap', () => {
|
|
10
|
+
let roapRequest;
|
|
11
|
+
let webex;
|
|
12
|
+
const locusUrl = 'locusUrl';
|
|
13
|
+
|
|
14
|
+
beforeEach(async () => {
|
|
15
|
+
webex = new MockWebex({
|
|
16
|
+
children: {
|
|
17
|
+
meetings: Meetings,
|
|
18
|
+
},
|
|
15
19
|
});
|
|
16
|
-
|
|
17
|
-
it('attaches the reachability data when it exists', async () => {
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
const roapRequest = new RoapRequest({}, {parent: webex});
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
webex.meetings.clientRegion = {
|
|
22
|
+
countryCode: 'US',
|
|
23
|
+
regionCode: 'WEST-COAST',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
webex.internal = {
|
|
27
|
+
services: {
|
|
28
|
+
get: sinon.mock().returns(locusUrl),
|
|
29
|
+
waitForCatalog: sinon.mock().returns(Promise.resolve({})),
|
|
30
|
+
},
|
|
31
|
+
device: {
|
|
32
|
+
url: 'url',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
roapRequest = new RoapRequest({webex});
|
|
38
|
+
|
|
39
|
+
roapRequest.request = sinon.mock().returns(
|
|
40
|
+
Promise.resolve({
|
|
41
|
+
body: {
|
|
42
|
+
locus: {
|
|
43
|
+
roapSeq: '',
|
|
44
|
+
id: '',
|
|
45
|
+
url: 'url/path',
|
|
46
|
+
fullState: {
|
|
47
|
+
lastActive: 'lastActive',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
);
|
|
22
53
|
|
|
23
|
-
|
|
54
|
+
Metrics.postEvent = sinon.stub().returns();
|
|
24
55
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
56
|
+
await webex.boundedStorage.put(
|
|
57
|
+
REACHABILITY.namespace,
|
|
58
|
+
REACHABILITY.localStorageJoinCookie,
|
|
59
|
+
JSON.stringify({
|
|
60
|
+
anycastEntryPoint: 'aws-eu-west-1',
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
await webex.boundedStorage.put(
|
|
64
|
+
REACHABILITY.namespace,
|
|
65
|
+
REACHABILITY.localStorageResult,
|
|
66
|
+
JSON.stringify({
|
|
67
|
+
clusterId: {
|
|
68
|
+
udp: 'test',
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
});
|
|
30
73
|
|
|
31
|
-
|
|
74
|
+
describe('#attachReachabilityData', () => {
|
|
75
|
+
it('returns the correct reachability data', async () => {
|
|
76
|
+
const res = await roapRequest.attachReachabilityData({});
|
|
32
77
|
|
|
33
|
-
assert.deepEqual(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
78
|
+
assert.deepEqual(res.localSdp, {
|
|
79
|
+
reachability: {
|
|
80
|
+
clusterId: {
|
|
81
|
+
udp: 'test',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
assert.deepEqual(res.joinCookie, {
|
|
86
|
+
anycastEntryPoint: 'aws-eu-west-1',
|
|
87
|
+
});
|
|
37
88
|
});
|
|
38
|
-
|
|
39
|
-
it('handles the case when realiability data does not exist', async () => {
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
const roapRequest = new RoapRequest({}, {parent: webex});
|
|
42
89
|
|
|
43
|
-
|
|
90
|
+
it('handles the case when reachability data does not exist', async () => {
|
|
91
|
+
await webex.boundedStorage.del(REACHABILITY.namespace, REACHABILITY.localStorageJoinCookie);
|
|
44
92
|
|
|
45
|
-
|
|
93
|
+
await webex.boundedStorage.del(REACHABILITY.namespace, REACHABILITY.localStorageResult);
|
|
94
|
+
const sdp = {
|
|
95
|
+
some: 'attribute',
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const result = await roapRequest.attachReachabilityData(sdp);
|
|
46
99
|
|
|
47
|
-
assert.deepEqual(
|
|
100
|
+
assert.deepEqual(result, {
|
|
101
|
+
joinCookie: undefined,
|
|
102
|
+
localSdp: {
|
|
103
|
+
some: 'attribute',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
48
106
|
});
|
|
49
107
|
});
|
|
50
108
|
|
|
51
109
|
describe('sendRoap', () => {
|
|
52
|
-
|
|
110
|
+
it('includes joinCookie in the request correctly', async () => {
|
|
111
|
+
await roapRequest.sendRoap({
|
|
112
|
+
locusSelfUrl: locusUrl,
|
|
113
|
+
mediaId: 'mediaId',
|
|
114
|
+
roapMessage: {
|
|
115
|
+
seq: 'seq',
|
|
116
|
+
},
|
|
117
|
+
});
|
|
53
118
|
|
|
54
|
-
|
|
55
|
-
|
|
119
|
+
const requestParams = roapRequest.request.getCall(0).args[0];
|
|
120
|
+
assert.equal(requestParams.method, 'PUT');
|
|
121
|
+
assert.equal(requestParams.uri, `${locusUrl}/media`);
|
|
122
|
+
assert.deepEqual(requestParams.body.localMedias, [
|
|
123
|
+
{
|
|
124
|
+
localSdp:
|
|
125
|
+
'{"roapMessage":{"seq":"seq"},"audioMuted":false,"videoMuted":false,"reachability":{"clusterId":{"udp":"test"}}}',
|
|
126
|
+
mediaId: 'mediaId',
|
|
127
|
+
},
|
|
128
|
+
]);
|
|
129
|
+
assert.deepEqual(requestParams.body.clientMediaPreferences, {
|
|
130
|
+
joinCookie: {
|
|
131
|
+
anycastEntryPoint: 'aws-eu-west-1',
|
|
132
|
+
},
|
|
133
|
+
preferTranscoding: true,
|
|
134
|
+
});
|
|
56
135
|
});
|
|
136
|
+
});
|
|
57
137
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const roapRequest = new RoapRequest({}, {parent: webex});
|
|
63
|
-
|
|
64
|
-
const newSdp = {new: 'sdp'}
|
|
138
|
+
it('calls attachReachabilityData when sendRoap', async () => {
|
|
139
|
+
const newSdp = {
|
|
140
|
+
new: 'sdp',
|
|
141
|
+
};
|
|
65
142
|
|
|
66
|
-
|
|
67
|
-
|
|
143
|
+
roapRequest.attachReachabilityData = sinon.stub().returns(
|
|
144
|
+
Promise.resolve({
|
|
145
|
+
localSdp: newSdp,
|
|
146
|
+
joinCookie: {
|
|
147
|
+
anycastEntryPoint: 'aws-eu-west-1',
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
webex.request.returns(
|
|
152
|
+
Promise.resolve({
|
|
68
153
|
body: {
|
|
69
|
-
locus: {}
|
|
70
|
-
}
|
|
71
|
-
})
|
|
154
|
+
locus: {},
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const result = await roapRequest.sendRoap({
|
|
160
|
+
roapMessage: {
|
|
161
|
+
seq: 1,
|
|
162
|
+
},
|
|
163
|
+
locusSelfUrl: 'locusSelfUrl',
|
|
164
|
+
mediaId: 'mediaId',
|
|
165
|
+
correlationId: 'correlationId',
|
|
166
|
+
audioMuted: true,
|
|
167
|
+
videoMuted: true,
|
|
168
|
+
meetingId: 'meetingId',
|
|
169
|
+
preferTranscoding: true,
|
|
170
|
+
});
|
|
72
171
|
|
|
73
|
-
|
|
74
|
-
roapMessage: {seq: 1},
|
|
75
|
-
locusSelfUrl: 'locusSelfUrl',
|
|
76
|
-
mediaId: 'mediaId',
|
|
77
|
-
correlationId: 'correlationId',
|
|
78
|
-
audioMuted: true,
|
|
79
|
-
videoMuted: true,
|
|
80
|
-
meetingId: 'meetingId',
|
|
81
|
-
preferTranscoding: true
|
|
82
|
-
});
|
|
172
|
+
const requestParams = roapRequest.request.getCall(0).args[0];
|
|
83
173
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
174
|
+
assert.deepEqual(requestParams, {
|
|
175
|
+
uri: 'locusSelfUrl/media',
|
|
176
|
+
method: 'PUT',
|
|
177
|
+
body: {
|
|
178
|
+
device: {
|
|
179
|
+
url: 'url',
|
|
180
|
+
deviceType: undefined,
|
|
181
|
+
},
|
|
182
|
+
correlationId: 'correlationId',
|
|
183
|
+
localMedias: [
|
|
184
|
+
{
|
|
94
185
|
localSdp: JSON.stringify(newSdp),
|
|
95
|
-
mediaId: 'mediaId'
|
|
96
|
-
}
|
|
97
|
-
|
|
186
|
+
mediaId: 'mediaId',
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
clientMediaPreferences: {
|
|
190
|
+
joinCookie: {
|
|
191
|
+
anycastEntryPoint: 'aws-eu-west-1',
|
|
192
|
+
},
|
|
193
|
+
preferTranscoding: true,
|
|
98
194
|
},
|
|
99
|
-
}
|
|
195
|
+
},
|
|
196
|
+
});
|
|
100
197
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
198
|
+
assert.calledOnceWithExactly(roapRequest.attachReachabilityData, {
|
|
199
|
+
roapMessage: {
|
|
200
|
+
seq: 1,
|
|
201
|
+
},
|
|
202
|
+
audioMuted: true,
|
|
203
|
+
videoMuted: true,
|
|
204
|
+
});
|
|
106
205
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
206
|
+
assert.deepEqual(result, {
|
|
207
|
+
locus: {
|
|
208
|
+
fullState: {
|
|
209
|
+
lastActive: 'lastActive',
|
|
210
|
+
},
|
|
211
|
+
id: '',
|
|
212
|
+
roapSeq: 1,
|
|
213
|
+
url: 'url/path',
|
|
214
|
+
}
|
|
112
215
|
});
|
|
113
|
-
})
|
|
216
|
+
});
|
|
114
217
|
});
|