@webex/internal-plugin-device 3.0.0-beta.3 → 3.0.0-beta.30
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 +10 -6
- package/dist/config.js +0 -8
- package/dist/config.js.map +1 -1
- package/dist/constants.js +2 -3
- package/dist/constants.js.map +1 -1
- package/dist/device.js +91 -169
- package/dist/device.js.map +1 -1
- package/dist/features/feature-collection.js +1 -8
- package/dist/features/feature-collection.js.map +1 -1
- package/dist/features/feature-model.js +15 -42
- package/dist/features/feature-model.js.map +1 -1
- package/dist/features/features-model.js +9 -21
- package/dist/features/features-model.js.map +1 -1
- package/dist/features/index.js +0 -8
- package/dist/features/index.js.map +1 -1
- package/dist/index.js +2 -24
- package/dist/index.js.map +1 -1
- package/dist/interceptors/device-url.js +12 -33
- package/dist/interceptors/device-url.js.map +1 -1
- package/dist/metrics.js +0 -2
- package/dist/metrics.js.map +1 -1
- package/package.json +10 -10
- package/src/config.js +8 -9
- package/src/constants.js +3 -5
- package/src/device.js +140 -144
- package/src/features/feature-collection.js +1 -1
- package/src/features/feature-model.js +5 -11
- package/src/features/features-model.js +3 -9
- package/src/features/index.js +1 -5
- package/src/index.js +3 -11
- package/src/interceptors/device-url.js +5 -7
- package/src/metrics.js +1 -2
- package/test/integration/spec/device.js +210 -239
- package/test/integration/spec/webex.js +9 -9
- package/test/unit/spec/device.js +44 -53
- package/test/unit/spec/features/feature-collection.js +2 -2
- package/test/unit/spec/features/feature-model.js +23 -39
- package/test/unit/spec/features/features-model.js +4 -12
- package/test/unit/spec/interceptors/device-url.js +69 -109
- package/test/unit/spec/wdm-dto.json +5 -13
|
@@ -21,19 +21,19 @@ describe('plugin-device', () => {
|
|
|
21
21
|
resource: '/example/resource/',
|
|
22
22
|
service: 'example',
|
|
23
23
|
serviceUrl: 'https://www.example-service.com/',
|
|
24
|
-
uri: 'https://www.example-uri.com/'
|
|
24
|
+
uri: 'https://www.example-uri.com/',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
interceptor.webex = {
|
|
28
28
|
internal: {
|
|
29
29
|
device: {
|
|
30
|
-
url: fixture.uri
|
|
30
|
+
url: fixture.uri,
|
|
31
31
|
},
|
|
32
32
|
services: {
|
|
33
33
|
waitForService: sinon.stub().resolves(fixture.serviceUrl),
|
|
34
|
-
getServiceFromUrl: sinon.stub().returns({name: fixture.service})
|
|
35
|
-
}
|
|
36
|
-
}
|
|
34
|
+
getServiceFromUrl: sinon.stub().returns({name: fixture.service}),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
waitForService = interceptor.webex.internal.services.waitForService;
|
|
@@ -48,12 +48,13 @@ describe('plugin-device', () => {
|
|
|
48
48
|
interceptor.webex.internal.device.url = undefined;
|
|
49
49
|
options = {
|
|
50
50
|
headers: {
|
|
51
|
-
'cisco-device-url': fixture.url
|
|
51
|
+
'cisco-device-url': fixture.url,
|
|
52
52
|
},
|
|
53
|
-
...options
|
|
53
|
+
...options,
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
return interceptor
|
|
56
|
+
return interceptor
|
|
57
|
+
.onRequest({...options})
|
|
57
58
|
.then((results) => assert.deepEqual(results, options));
|
|
58
59
|
});
|
|
59
60
|
|
|
@@ -62,12 +63,13 @@ describe('plugin-device', () => {
|
|
|
62
63
|
interceptor.webex.internal.device.url = undefined;
|
|
63
64
|
options = {
|
|
64
65
|
headers: {
|
|
65
|
-
'cisco-device-url': undefined
|
|
66
|
+
'cisco-device-url': undefined,
|
|
66
67
|
},
|
|
67
|
-
...options
|
|
68
|
+
...options,
|
|
68
69
|
};
|
|
69
70
|
|
|
70
|
-
return interceptor
|
|
71
|
+
return interceptor
|
|
72
|
+
.onRequest({...options})
|
|
71
73
|
.then((results) => assert.deepEqual(results, options));
|
|
72
74
|
});
|
|
73
75
|
});
|
|
@@ -75,12 +77,13 @@ describe('plugin-device', () => {
|
|
|
75
77
|
describe('when service does not exist', () => {
|
|
76
78
|
it('should return the options', () => {
|
|
77
79
|
interceptor.webex.internal.device.url = 'http://device-url.com/';
|
|
78
|
-
interceptor.webex.internal.services.waitForService =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
interceptor.webex.internal.services.waitForService = sinon
|
|
81
|
+
.stub()
|
|
82
|
+
.resolves('http://example-url.com/');
|
|
83
|
+
interceptor.webex.internal.services.getServiceFromUrl = sinon.stub().returns();
|
|
82
84
|
|
|
83
|
-
return interceptor
|
|
85
|
+
return interceptor
|
|
86
|
+
.onRequest({...options})
|
|
84
87
|
.then((results) => assert.deepEqual(results, options));
|
|
85
88
|
});
|
|
86
89
|
});
|
|
@@ -90,71 +93,50 @@ describe('plugin-device', () => {
|
|
|
90
93
|
it('when only the service property is provided', () => {
|
|
91
94
|
options.service = fixture.service;
|
|
92
95
|
|
|
93
|
-
interceptor.onRequest(options)
|
|
94
|
-
.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
service: options.service,
|
|
99
|
-
url: undefined
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
assert.calledWith(
|
|
103
|
-
getServiceFromUrl,
|
|
104
|
-
fixture.serviceUrl
|
|
105
|
-
);
|
|
106
|
-
assert.isDefined(options.headers['cisco-device-url']);
|
|
107
|
-
assert.equal(results.headers['cisco-device-url'], fixture.uri);
|
|
96
|
+
interceptor.onRequest(options).then((results) => {
|
|
97
|
+
assert.calledWith(waitForService, {
|
|
98
|
+
service: options.service,
|
|
99
|
+
url: undefined,
|
|
108
100
|
});
|
|
101
|
+
assert.calledWith(getServiceFromUrl, fixture.serviceUrl);
|
|
102
|
+
assert.isDefined(options.headers['cisco-device-url']);
|
|
103
|
+
assert.equal(results.headers['cisco-device-url'], fixture.uri);
|
|
104
|
+
});
|
|
109
105
|
});
|
|
110
106
|
|
|
111
107
|
it('when only the uri property is provided', () => {
|
|
112
108
|
options = {
|
|
113
109
|
uri: fixture.uri,
|
|
114
|
-
...options
|
|
110
|
+
...options,
|
|
115
111
|
};
|
|
116
112
|
|
|
117
|
-
interceptor.onRequest(options)
|
|
118
|
-
.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
service: undefined,
|
|
123
|
-
url: options.uri
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
assert.calledWith(
|
|
127
|
-
getServiceFromUrl,
|
|
128
|
-
fixture.serviceUrl
|
|
129
|
-
);
|
|
130
|
-
assert.isDefined(results.headers['cisco-device-url']);
|
|
131
|
-
assert.equal(results.headers['cisco-device-url'], fixture.uri);
|
|
113
|
+
interceptor.onRequest(options).then((results) => {
|
|
114
|
+
assert.calledWith(waitForService, {
|
|
115
|
+
service: undefined,
|
|
116
|
+
url: options.uri,
|
|
132
117
|
});
|
|
118
|
+
assert.calledWith(getServiceFromUrl, fixture.serviceUrl);
|
|
119
|
+
assert.isDefined(results.headers['cisco-device-url']);
|
|
120
|
+
assert.equal(results.headers['cisco-device-url'], fixture.uri);
|
|
121
|
+
});
|
|
133
122
|
});
|
|
134
123
|
|
|
135
124
|
it('when both the service and uri properties are provided', () => {
|
|
136
125
|
options = {
|
|
137
126
|
services: fixture.service,
|
|
138
127
|
uri: fixture.uri,
|
|
139
|
-
...options
|
|
128
|
+
...options,
|
|
140
129
|
};
|
|
141
130
|
|
|
142
|
-
interceptor.onRequest(options)
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
service: options.service,
|
|
148
|
-
url: options.uri
|
|
149
|
-
}
|
|
150
|
-
);
|
|
151
|
-
assert.calledWith(
|
|
152
|
-
getServiceFromUrl,
|
|
153
|
-
fixture.serviceUrl
|
|
154
|
-
);
|
|
155
|
-
assert.isDefined(results.headers['cisco-device-url']);
|
|
156
|
-
assert.equal(results.headers['cisco-device-url'], fixture.uri);
|
|
131
|
+
interceptor.onRequest(options).then((results) => {
|
|
132
|
+
assert.calledWith(waitForService, {
|
|
133
|
+
service: options.service,
|
|
134
|
+
url: options.uri,
|
|
157
135
|
});
|
|
136
|
+
assert.calledWith(getServiceFromUrl, fixture.serviceUrl);
|
|
137
|
+
assert.isDefined(results.headers['cisco-device-url']);
|
|
138
|
+
assert.equal(results.headers['cisco-device-url'], fixture.uri);
|
|
139
|
+
});
|
|
158
140
|
});
|
|
159
141
|
|
|
160
142
|
describe('does not add cisco-device-url due to invalid service name', () => {
|
|
@@ -164,24 +146,17 @@ describe('plugin-device', () => {
|
|
|
164
146
|
options = {
|
|
165
147
|
services: fixture.service,
|
|
166
148
|
uri: fixture.uri,
|
|
167
|
-
...options
|
|
149
|
+
...options,
|
|
168
150
|
};
|
|
169
151
|
|
|
170
|
-
interceptor.onRequest(options)
|
|
171
|
-
.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
service: options.service,
|
|
176
|
-
url: options.uri
|
|
177
|
-
}
|
|
178
|
-
);
|
|
179
|
-
assert.calledWith(
|
|
180
|
-
getServiceFromUrl,
|
|
181
|
-
fixture.serviceUrl
|
|
182
|
-
);
|
|
183
|
-
assert.isUndefined(results.headers);
|
|
152
|
+
interceptor.onRequest(options).then((results) => {
|
|
153
|
+
assert.calledWith(waitForService, {
|
|
154
|
+
service: options.service,
|
|
155
|
+
url: options.uri,
|
|
184
156
|
});
|
|
157
|
+
assert.calledWith(getServiceFromUrl, fixture.serviceUrl);
|
|
158
|
+
assert.isUndefined(results.headers);
|
|
159
|
+
});
|
|
185
160
|
});
|
|
186
161
|
|
|
187
162
|
it('service is `oauth` returns the original object', () => {
|
|
@@ -190,24 +165,17 @@ describe('plugin-device', () => {
|
|
|
190
165
|
options = {
|
|
191
166
|
services: fixture.service,
|
|
192
167
|
uri: fixture.uri,
|
|
193
|
-
...options
|
|
168
|
+
...options,
|
|
194
169
|
};
|
|
195
170
|
|
|
196
|
-
interceptor.onRequest(options)
|
|
197
|
-
.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
{
|
|
201
|
-
service: options.service,
|
|
202
|
-
url: options.uri
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
assert.calledWith(
|
|
206
|
-
getServiceFromUrl,
|
|
207
|
-
fixture.serviceUrl
|
|
208
|
-
);
|
|
209
|
-
assert.isUndefined(results.headers);
|
|
171
|
+
interceptor.onRequest(options).then((results) => {
|
|
172
|
+
assert.calledWith(waitForService, {
|
|
173
|
+
service: options.service,
|
|
174
|
+
url: options.uri,
|
|
210
175
|
});
|
|
176
|
+
assert.calledWith(getServiceFromUrl, fixture.serviceUrl);
|
|
177
|
+
assert.isUndefined(results.headers);
|
|
178
|
+
});
|
|
211
179
|
});
|
|
212
180
|
|
|
213
181
|
it('service is `saml` returns the original object', () => {
|
|
@@ -216,28 +184,20 @@ describe('plugin-device', () => {
|
|
|
216
184
|
options = {
|
|
217
185
|
services: fixture.service,
|
|
218
186
|
uri: fixture.uri,
|
|
219
|
-
...options
|
|
187
|
+
...options,
|
|
220
188
|
};
|
|
221
189
|
|
|
222
|
-
interceptor.onRequest(options)
|
|
223
|
-
.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
{
|
|
227
|
-
service: options.service,
|
|
228
|
-
url: options.uri
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
assert.calledWith(
|
|
232
|
-
getServiceFromUrl,
|
|
233
|
-
fixture.serviceUrl
|
|
234
|
-
);
|
|
235
|
-
assert.isUndefined(results.headers);
|
|
190
|
+
interceptor.onRequest(options).then((results) => {
|
|
191
|
+
assert.calledWith(waitForService, {
|
|
192
|
+
service: options.service,
|
|
193
|
+
url: options.uri,
|
|
236
194
|
});
|
|
195
|
+
assert.calledWith(getServiceFromUrl, fixture.serviceUrl);
|
|
196
|
+
assert.isUndefined(results.headers);
|
|
197
|
+
});
|
|
237
198
|
});
|
|
238
199
|
});
|
|
239
200
|
|
|
240
|
-
|
|
241
201
|
describe('waitForService returns a rejection', () => {
|
|
242
202
|
beforeEach(() => {
|
|
243
203
|
waitForService.rejects();
|
|
@@ -50,26 +50,20 @@
|
|
|
50
50
|
},
|
|
51
51
|
"creationTime": "2020-01-01T12:12:12.000Z",
|
|
52
52
|
"modificationTime": "2020-01-01T12:12:12.000Z",
|
|
53
|
-
"deviceSettings": {
|
|
54
|
-
|
|
55
|
-
},
|
|
53
|
+
"deviceSettings": {},
|
|
56
54
|
"deviceSettingsString": "{}",
|
|
57
55
|
"showSupportText": false,
|
|
58
56
|
"reportingSiteUrl": "www.example.com/report",
|
|
59
57
|
"reportingSiteDesc": "Example Description",
|
|
60
58
|
"isDeviceManaged": false,
|
|
61
|
-
"trainSiteNames": [
|
|
62
|
-
|
|
63
|
-
],
|
|
59
|
+
"trainSiteNames": [],
|
|
64
60
|
"clientSecurityPolicy": "on",
|
|
65
61
|
"intranetInactivityCheckUrl": "www.example-intranet.com/spark_session_check.json",
|
|
66
62
|
"blockExternalCommunications": false,
|
|
67
63
|
"clientMessagingGiphy": "ALLOW",
|
|
68
64
|
"clientMessagingLinkPreview": "ALLOW",
|
|
69
65
|
"ecmEnabledForAllUsers": false,
|
|
70
|
-
"ecmSupportedStorageProviders": [
|
|
71
|
-
|
|
72
|
-
],
|
|
66
|
+
"ecmSupportedStorageProviders": [],
|
|
73
67
|
"defaultEcmMicrosoftCloud": "GLOBAL",
|
|
74
68
|
"ecmMicrosoftTenant": "",
|
|
75
69
|
"ecmScreenCaptureFeatureAllowed": true,
|
|
@@ -88,9 +82,7 @@
|
|
|
88
82
|
"mobileAutoLockIdleTimeout": 0,
|
|
89
83
|
"disableMeetingScheduling": false,
|
|
90
84
|
"ecmEnabledForAllUsers": false,
|
|
91
|
-
"ecmSupportedStorageProviders": [
|
|
92
|
-
|
|
93
|
-
],
|
|
85
|
+
"ecmSupportedStorageProviders": [],
|
|
94
86
|
"defaultEcmMicrosoftCloud": "GLOBAL",
|
|
95
87
|
"ecmMicrosoftTenant": "",
|
|
96
88
|
"restrictAccountsToEmailDomain": false,
|
|
@@ -109,4 +101,4 @@
|
|
|
109
101
|
},
|
|
110
102
|
"userId": "USERID",
|
|
111
103
|
"orgId": "ORGID"
|
|
112
|
-
}
|
|
104
|
+
}
|