@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
|
@@ -11,14 +11,15 @@ describe('plugin-device', () => {
|
|
|
11
11
|
let user;
|
|
12
12
|
let webex;
|
|
13
13
|
|
|
14
|
-
before('create users', () =>
|
|
15
|
-
.then(([createdUser]) => {
|
|
14
|
+
before('create users', () =>
|
|
15
|
+
testUsers.create({count: 1}).then(([createdUser]) => {
|
|
16
16
|
user = createdUser;
|
|
17
|
-
})
|
|
17
|
+
})
|
|
18
|
+
);
|
|
18
19
|
|
|
19
20
|
beforeEach('create webex instance', () => {
|
|
20
21
|
webex = new WebexCore({
|
|
21
|
-
credentials: user.token
|
|
22
|
+
credentials: user.token,
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
device = webex.internal.device;
|
|
@@ -32,11 +33,10 @@ describe('plugin-device', () => {
|
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
it('unregisters the device', () =>
|
|
35
|
-
webex.logout({noRedirect: true})
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}));
|
|
36
|
+
webex.logout({noRedirect: true}).then(() => {
|
|
37
|
+
assert.called(device.unregister);
|
|
38
|
+
assert.isFalse(device.registered);
|
|
39
|
+
}));
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
42
|
});
|
package/test/unit/spec/device.js
CHANGED
|
@@ -15,8 +15,8 @@ describe('plugin-device', () => {
|
|
|
15
15
|
beforeEach('initialize webex with the device plugin', () => {
|
|
16
16
|
webex = new MockWebex({
|
|
17
17
|
children: {
|
|
18
|
-
device: Device
|
|
19
|
-
}
|
|
18
|
+
device: Device,
|
|
19
|
+
},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const clonedDTO = cloneDeep(dto);
|
|
@@ -35,20 +35,17 @@ describe('plugin-device', () => {
|
|
|
35
35
|
spy = sinon.spy();
|
|
36
36
|
modifiedDTOFeatures = {
|
|
37
37
|
...dto.features,
|
|
38
|
-
user: [
|
|
39
|
-
...dto.features.user,
|
|
40
|
-
...dto.features.developer
|
|
41
|
-
]
|
|
38
|
+
user: [...dto.features.user, ...dto.features.developer],
|
|
42
39
|
};
|
|
43
40
|
});
|
|
44
41
|
|
|
45
|
-
it(
|
|
42
|
+
it("should trigger a 'change' event", () => {
|
|
46
43
|
device.on('change', spy);
|
|
47
44
|
device.features.set(modifiedDTOFeatures);
|
|
48
45
|
assert.called(spy);
|
|
49
46
|
});
|
|
50
47
|
|
|
51
|
-
it(
|
|
48
|
+
it("should trigger a 'change:features' event", () => {
|
|
52
49
|
device.on('change:features', spy);
|
|
53
50
|
device.features.set(modifiedDTOFeatures);
|
|
54
51
|
assert.called(spy);
|
|
@@ -60,12 +57,12 @@ describe('plugin-device', () => {
|
|
|
60
57
|
device.checkNetworkReachability = sinon.spy();
|
|
61
58
|
});
|
|
62
59
|
|
|
63
|
-
describe(
|
|
64
|
-
beforeEach(
|
|
60
|
+
describe("when the 'intranetInactivityCheckUrl' changes", () => {
|
|
61
|
+
beforeEach("change 'intranetInactivityCheckUrl'", () => {
|
|
65
62
|
device.intranetInactivityCheckUrl = 'https://not-a-url.com';
|
|
66
63
|
});
|
|
67
64
|
|
|
68
|
-
it(
|
|
65
|
+
it("should call 'checkNetworkReachability()'", () => {
|
|
69
66
|
assert.called(device.checkNetworkReachability);
|
|
70
67
|
});
|
|
71
68
|
|
|
@@ -74,12 +71,12 @@ describe('plugin-device', () => {
|
|
|
74
71
|
});
|
|
75
72
|
});
|
|
76
73
|
|
|
77
|
-
describe(
|
|
78
|
-
beforeEach(
|
|
74
|
+
describe("when the 'intranetInactivityDuration' changes", () => {
|
|
75
|
+
beforeEach("change 'intranetInactivityDuration'", () => {
|
|
79
76
|
device.intranetInactivityDuration = 1234;
|
|
80
77
|
});
|
|
81
78
|
|
|
82
|
-
it(
|
|
79
|
+
it("should call 'checkNetworkReachability()'", () => {
|
|
83
80
|
assert.called(device.checkNetworkReachability);
|
|
84
81
|
});
|
|
85
82
|
|
|
@@ -88,12 +85,12 @@ describe('plugin-device', () => {
|
|
|
88
85
|
});
|
|
89
86
|
});
|
|
90
87
|
|
|
91
|
-
describe(
|
|
92
|
-
beforeEach(
|
|
88
|
+
describe("when the 'inNetworkInactivityDuration' changes", () => {
|
|
89
|
+
beforeEach("change 'inNetworkInactivityDuration'", () => {
|
|
93
90
|
device.inNetworkInactivityDuration = 1234;
|
|
94
91
|
});
|
|
95
92
|
|
|
96
|
-
it(
|
|
93
|
+
it("should call 'checkNetworkReachability()'", () => {
|
|
97
94
|
assert.called(device.checkNetworkReachability);
|
|
98
95
|
assert.isTrue(device.isReachabilityChecked);
|
|
99
96
|
});
|
|
@@ -104,7 +101,7 @@ describe('plugin-device', () => {
|
|
|
104
101
|
describe('derived properties', () => {
|
|
105
102
|
describe('#registered', () => {
|
|
106
103
|
describe('when the device does not have a url', () => {
|
|
107
|
-
beforeEach(
|
|
104
|
+
beforeEach("remove the device's url", () => {
|
|
108
105
|
device.url = undefined;
|
|
109
106
|
});
|
|
110
107
|
|
|
@@ -114,7 +111,7 @@ describe('plugin-device', () => {
|
|
|
114
111
|
});
|
|
115
112
|
|
|
116
113
|
describe('when the device does have a url', () => {
|
|
117
|
-
beforeEach(
|
|
114
|
+
beforeEach("set the device's url", () => {
|
|
118
115
|
device.url = dto.url;
|
|
119
116
|
});
|
|
120
117
|
|
|
@@ -149,7 +146,7 @@ describe('plugin-device', () => {
|
|
|
149
146
|
device.resetLogoutTimer = sinon.spy();
|
|
150
147
|
});
|
|
151
148
|
|
|
152
|
-
it(
|
|
149
|
+
it("should create a 'change:lastUserActivityDate' listener", () => {
|
|
153
150
|
device.setLogoutTimer(60000);
|
|
154
151
|
device.trigger('change:lastUserActivityDate');
|
|
155
152
|
assert.called(device.resetLogoutTimer);
|
|
@@ -173,10 +170,7 @@ describe('plugin-device', () => {
|
|
|
173
170
|
});
|
|
174
171
|
|
|
175
172
|
it('should serialize user feature keys', () => {
|
|
176
|
-
assert.hasAllKeys(
|
|
177
|
-
device.serialize().features.user,
|
|
178
|
-
Object.keys(dto.features.user)
|
|
179
|
-
);
|
|
173
|
+
assert.hasAllKeys(device.serialize().features.user, Object.keys(dto.features.user));
|
|
180
174
|
});
|
|
181
175
|
});
|
|
182
176
|
|
|
@@ -201,7 +195,7 @@ describe('plugin-device', () => {
|
|
|
201
195
|
await result;
|
|
202
196
|
|
|
203
197
|
assert.deepEqual(requestSpy.args[0][0].headers, {
|
|
204
|
-
'If-None-Match': 'etag-value'
|
|
198
|
+
'If-None-Match': 'etag-value',
|
|
205
199
|
});
|
|
206
200
|
});
|
|
207
201
|
|
|
@@ -228,7 +222,7 @@ describe('plugin-device', () => {
|
|
|
228
222
|
val: 'true',
|
|
229
223
|
value: true,
|
|
230
224
|
mutable: true,
|
|
231
|
-
lastModified: '2015-06-29T20:02:48.033Z'
|
|
225
|
+
lastModified: '2015-06-29T20:02:48.033Z',
|
|
232
226
|
},
|
|
233
227
|
],
|
|
234
228
|
entitlement: [
|
|
@@ -236,18 +230,18 @@ describe('plugin-device', () => {
|
|
|
236
230
|
key: '2',
|
|
237
231
|
val: 'true',
|
|
238
232
|
value: true,
|
|
239
|
-
mutable: false
|
|
240
|
-
}
|
|
233
|
+
mutable: false,
|
|
234
|
+
},
|
|
241
235
|
],
|
|
242
236
|
user: [
|
|
243
237
|
{
|
|
244
238
|
key: '3',
|
|
245
239
|
val: 'true',
|
|
246
240
|
value: true,
|
|
247
|
-
mutable: true
|
|
248
|
-
}
|
|
241
|
+
mutable: true,
|
|
242
|
+
},
|
|
249
243
|
],
|
|
250
|
-
...overrides
|
|
244
|
+
...overrides,
|
|
251
245
|
};
|
|
252
246
|
|
|
253
247
|
return clonedDTO;
|
|
@@ -267,11 +261,9 @@ describe('plugin-device', () => {
|
|
|
267
261
|
|
|
268
262
|
const response = {
|
|
269
263
|
body: {
|
|
270
|
-
...clonedDTO
|
|
264
|
+
...clonedDTO,
|
|
271
265
|
},
|
|
272
|
-
headers: {
|
|
273
|
-
|
|
274
|
-
}
|
|
266
|
+
headers: {},
|
|
275
267
|
};
|
|
276
268
|
|
|
277
269
|
checkFeatureNotPresent('developer', '1');
|
|
@@ -292,11 +284,11 @@ describe('plugin-device', () => {
|
|
|
292
284
|
|
|
293
285
|
const response = {
|
|
294
286
|
body: {
|
|
295
|
-
...clonedDTO
|
|
287
|
+
...clonedDTO,
|
|
296
288
|
},
|
|
297
289
|
headers: {
|
|
298
|
-
etag: 'etag-value'
|
|
299
|
-
}
|
|
290
|
+
etag: 'etag-value',
|
|
291
|
+
},
|
|
300
292
|
};
|
|
301
293
|
|
|
302
294
|
checkFeatureNotPresent('developer', '1');
|
|
@@ -320,11 +312,11 @@ describe('plugin-device', () => {
|
|
|
320
312
|
|
|
321
313
|
const response = {
|
|
322
314
|
body: {
|
|
323
|
-
...clonedDTO
|
|
315
|
+
...clonedDTO,
|
|
324
316
|
},
|
|
325
317
|
headers: {
|
|
326
|
-
etag: 'etag-value'
|
|
327
|
-
}
|
|
318
|
+
etag: 'etag-value',
|
|
319
|
+
},
|
|
328
320
|
};
|
|
329
321
|
|
|
330
322
|
checkFeatureNotPresent('developer', '1');
|
|
@@ -348,11 +340,11 @@ describe('plugin-device', () => {
|
|
|
348
340
|
|
|
349
341
|
const response = {
|
|
350
342
|
body: {
|
|
351
|
-
...clonedDTO
|
|
343
|
+
...clonedDTO,
|
|
352
344
|
},
|
|
353
345
|
headers: {
|
|
354
|
-
etag: 'different-etag-value'
|
|
355
|
-
}
|
|
346
|
+
etag: 'different-etag-value',
|
|
347
|
+
},
|
|
356
348
|
};
|
|
357
349
|
|
|
358
350
|
checkFeatureNotPresent('developer', '1');
|
|
@@ -376,7 +368,7 @@ describe('plugin-device', () => {
|
|
|
376
368
|
val: 'false',
|
|
377
369
|
value: false,
|
|
378
370
|
mutable: true,
|
|
379
|
-
lastModified: '2015-06-29T20:02:48.033Z'
|
|
371
|
+
lastModified: '2015-06-29T20:02:48.033Z',
|
|
380
372
|
},
|
|
381
373
|
],
|
|
382
374
|
entitlement: [
|
|
@@ -384,27 +376,26 @@ describe('plugin-device', () => {
|
|
|
384
376
|
key: '2',
|
|
385
377
|
val: 'false',
|
|
386
378
|
value: false,
|
|
387
|
-
mutable: false
|
|
388
|
-
}
|
|
379
|
+
mutable: false,
|
|
380
|
+
},
|
|
389
381
|
],
|
|
390
382
|
user: [
|
|
391
383
|
{
|
|
392
384
|
key: '3',
|
|
393
385
|
val: 'false',
|
|
394
386
|
value: false,
|
|
395
|
-
mutable: true
|
|
396
|
-
}
|
|
387
|
+
mutable: true,
|
|
388
|
+
},
|
|
397
389
|
],
|
|
398
390
|
});
|
|
399
391
|
|
|
400
|
-
|
|
401
392
|
const newResponse = {
|
|
402
393
|
body: {
|
|
403
|
-
...newClonedDTO
|
|
394
|
+
...newClonedDTO,
|
|
404
395
|
},
|
|
405
396
|
headers: {
|
|
406
|
-
etag: 'different-etag-value'
|
|
407
|
-
}
|
|
397
|
+
etag: 'different-etag-value',
|
|
398
|
+
},
|
|
408
399
|
};
|
|
409
400
|
|
|
410
401
|
device.processRegistrationSuccess(newResponse);
|
|
@@ -10,13 +10,13 @@ describe('plugin-device', () => {
|
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
describe('#mainIndex', () => {
|
|
13
|
-
it(
|
|
13
|
+
it("should have its index set to 'key'", () => {
|
|
14
14
|
assert.equal(featureCollection.mainIndex, 'key');
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
describe('#model', () => {
|
|
19
|
-
it(
|
|
19
|
+
it("should have its model set to the 'FeatureModel' class", () => {
|
|
20
20
|
assert.equal(featureCollection.model, FeatureModel);
|
|
21
21
|
});
|
|
22
22
|
});
|
|
@@ -14,7 +14,7 @@ describe('plugin-device', () => {
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
describe('#constructor()', () => {
|
|
17
|
-
describe(
|
|
17
|
+
describe("when the feature includes a 'lastModified' property", () => {
|
|
18
18
|
beforeEach('generate the feature model', () => {
|
|
19
19
|
featureModel = new FeatureModel(featureLM);
|
|
20
20
|
});
|
|
@@ -27,17 +27,14 @@ describe('plugin-device', () => {
|
|
|
27
27
|
assert.equal(featureLM.value, featureModel.value);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it(
|
|
30
|
+
it("should assign the 'lastModified' value as a 'Date'", () => {
|
|
31
31
|
assert.instanceOf(featureModel.lastModified, Date);
|
|
32
32
|
|
|
33
|
-
assert.equal(
|
|
34
|
-
featureModel.lastModified.toISOString(),
|
|
35
|
-
featureLM.lastModified
|
|
36
|
-
);
|
|
33
|
+
assert.equal(featureModel.lastModified.toISOString(), featureLM.lastModified);
|
|
37
34
|
});
|
|
38
35
|
});
|
|
39
36
|
|
|
40
|
-
describe(
|
|
37
|
+
describe("when the feature excludes a 'lastModified' property", () => {
|
|
41
38
|
beforeEach('generate the feature model', () => {
|
|
42
39
|
featureModel = new FeatureModel(featureNLM);
|
|
43
40
|
});
|
|
@@ -50,7 +47,7 @@ describe('plugin-device', () => {
|
|
|
50
47
|
assert.equal(featureNLM.value, featureModel.value);
|
|
51
48
|
});
|
|
52
49
|
|
|
53
|
-
it(
|
|
50
|
+
it("should not assign the 'lastModified' value", () => {
|
|
54
51
|
assert.isUndefined(featureModel.lastModified);
|
|
55
52
|
});
|
|
56
53
|
});
|
|
@@ -83,8 +80,7 @@ describe('plugin-device', () => {
|
|
|
83
80
|
it('should set the value to a instance of number', () =>
|
|
84
81
|
assert.typeOf(model.value, 'number'));
|
|
85
82
|
|
|
86
|
-
it(
|
|
87
|
-
assert.equal(model.type, 'number'));
|
|
83
|
+
it("should set the type to 'number'", () => assert.equal(model.type, 'number'));
|
|
88
84
|
|
|
89
85
|
it('should set the model value to the equivalent Number value', () =>
|
|
90
86
|
assert.equal(model.value, Number(fixture.val)));
|
|
@@ -96,11 +92,9 @@ describe('plugin-device', () => {
|
|
|
96
92
|
model = featureModel.parse(fixture);
|
|
97
93
|
});
|
|
98
94
|
|
|
99
|
-
it('should set the value to a boolean true', () =>
|
|
100
|
-
assert.equal(model.value, true));
|
|
95
|
+
it('should set the value to a boolean true', () => assert.equal(model.value, true));
|
|
101
96
|
|
|
102
|
-
it(
|
|
103
|
-
assert.equal(model.type, 'boolean'));
|
|
97
|
+
it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
|
|
104
98
|
});
|
|
105
99
|
|
|
106
100
|
describe('when the value is a True boolean', () => {
|
|
@@ -109,11 +103,9 @@ describe('plugin-device', () => {
|
|
|
109
103
|
model = featureModel.parse(fixture);
|
|
110
104
|
});
|
|
111
105
|
|
|
112
|
-
it('should set the value to a boolean true', () =>
|
|
113
|
-
assert.equal(model.value, true));
|
|
106
|
+
it('should set the value to a boolean true', () => assert.equal(model.value, true));
|
|
114
107
|
|
|
115
|
-
it(
|
|
116
|
-
assert.equal(model.type, 'boolean'));
|
|
108
|
+
it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
|
|
117
109
|
});
|
|
118
110
|
|
|
119
111
|
describe('when the value is a false string', () => {
|
|
@@ -122,11 +114,9 @@ describe('plugin-device', () => {
|
|
|
122
114
|
model = featureModel.parse(fixture);
|
|
123
115
|
});
|
|
124
116
|
|
|
125
|
-
it('should set the value to a boolean false', () =>
|
|
126
|
-
assert.equal(model.value, false));
|
|
117
|
+
it('should set the value to a boolean false', () => assert.equal(model.value, false));
|
|
127
118
|
|
|
128
|
-
it(
|
|
129
|
-
assert.equal(model.type, 'boolean'));
|
|
119
|
+
it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
|
|
130
120
|
});
|
|
131
121
|
|
|
132
122
|
describe('when the value is a False string', () => {
|
|
@@ -135,11 +125,9 @@ describe('plugin-device', () => {
|
|
|
135
125
|
model = featureModel.parse(fixture);
|
|
136
126
|
});
|
|
137
127
|
|
|
138
|
-
it('should set the value to a boolean false', () =>
|
|
139
|
-
assert.equal(model.value, false));
|
|
128
|
+
it('should set the value to a boolean false', () => assert.equal(model.value, false));
|
|
140
129
|
|
|
141
|
-
it(
|
|
142
|
-
assert.equal(model.type, 'boolean'));
|
|
130
|
+
it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
|
|
143
131
|
});
|
|
144
132
|
|
|
145
133
|
describe('when the value is a string', () => {
|
|
@@ -151,8 +139,7 @@ describe('plugin-device', () => {
|
|
|
151
139
|
it('should set the value to a instance of string', () =>
|
|
152
140
|
assert.typeOf(model.value, 'string'));
|
|
153
141
|
|
|
154
|
-
it(
|
|
155
|
-
assert.equal(model.type, 'string'));
|
|
142
|
+
it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
|
|
156
143
|
|
|
157
144
|
it('should set the model value to the equivalent string value', () =>
|
|
158
145
|
assert.equal(model.value, fixture.val));
|
|
@@ -167,8 +154,7 @@ describe('plugin-device', () => {
|
|
|
167
154
|
it('should set the value to the provided val property', () =>
|
|
168
155
|
assert.equal(model.value, fixture.val));
|
|
169
156
|
|
|
170
|
-
it(
|
|
171
|
-
assert.equal(model.type, 'string'));
|
|
157
|
+
it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
|
|
172
158
|
});
|
|
173
159
|
|
|
174
160
|
describe('when there is no value', () => {
|
|
@@ -177,11 +163,9 @@ describe('plugin-device', () => {
|
|
|
177
163
|
model = featureModel.parse(fixture);
|
|
178
164
|
});
|
|
179
165
|
|
|
180
|
-
it('should set the value to undefined', () =>
|
|
181
|
-
assert.isUndefined(model.value));
|
|
166
|
+
it('should set the value to undefined', () => assert.isUndefined(model.value));
|
|
182
167
|
|
|
183
|
-
it(
|
|
184
|
-
assert.equal(model.type, 'string'));
|
|
168
|
+
it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
|
|
185
169
|
});
|
|
186
170
|
});
|
|
187
171
|
});
|
|
@@ -189,7 +173,7 @@ describe('plugin-device', () => {
|
|
|
189
173
|
describe('#serialize()', () => {
|
|
190
174
|
let serialized;
|
|
191
175
|
|
|
192
|
-
describe(
|
|
176
|
+
describe("when the feature includes a 'lastModified' property", () => {
|
|
193
177
|
beforeEach('generate the feature model', () => {
|
|
194
178
|
featureModel = new FeatureModel(featureLM);
|
|
195
179
|
serialized = featureModel.serialize();
|
|
@@ -203,13 +187,13 @@ describe('plugin-device', () => {
|
|
|
203
187
|
assert.equal(featureLM.value, serialized.value);
|
|
204
188
|
});
|
|
205
189
|
|
|
206
|
-
it(
|
|
190
|
+
it("should assign the 'lastModified' value as a 'string'", () => {
|
|
207
191
|
assert.typeOf(serialized.lastModified, 'string');
|
|
208
192
|
assert.equal(serialized.lastModified, featureLM.lastModified);
|
|
209
193
|
});
|
|
210
194
|
});
|
|
211
195
|
|
|
212
|
-
describe(
|
|
196
|
+
describe("when the feature excludes a 'lastModified' property", () => {
|
|
213
197
|
beforeEach('generate the feature model', () => {
|
|
214
198
|
featureModel = new FeatureModel(featureNLM);
|
|
215
199
|
serialized = featureModel.serialize();
|
|
@@ -223,7 +207,7 @@ describe('plugin-device', () => {
|
|
|
223
207
|
assert.equal(featureNLM.value, serialized.value);
|
|
224
208
|
});
|
|
225
209
|
|
|
226
|
-
it(
|
|
210
|
+
it("should not assign the 'lastModified' value", () => {
|
|
227
211
|
assert.isUndefined(serialized.lastModified);
|
|
228
212
|
});
|
|
229
213
|
});
|
|
@@ -234,7 +218,7 @@ describe('plugin-device', () => {
|
|
|
234
218
|
let key;
|
|
235
219
|
let value;
|
|
236
220
|
|
|
237
|
-
beforeEach(
|
|
221
|
+
beforeEach("configure feature and set 'key' and 'value'", () => {
|
|
238
222
|
key = 'val';
|
|
239
223
|
value = 'false';
|
|
240
224
|
featureModel = new FeatureModel(featureLM);
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import {assert} from '@webex/test-helper-chai';
|
|
2
|
-
import {
|
|
3
|
-
constants,
|
|
4
|
-
FeatureModel,
|
|
5
|
-
FeaturesModel
|
|
6
|
-
} from '@webex/internal-plugin-device';
|
|
2
|
+
import {constants, FeatureModel, FeaturesModel} from '@webex/internal-plugin-device';
|
|
7
3
|
import sinon from 'sinon';
|
|
8
4
|
|
|
9
5
|
import dto from '../wdm-dto';
|
|
@@ -17,12 +13,8 @@ describe('plugin-device', () => {
|
|
|
17
13
|
});
|
|
18
14
|
|
|
19
15
|
describe('collections', () => {
|
|
20
|
-
it(
|
|
21
|
-
assert.containsAllKeys(featuresModel, [
|
|
22
|
-
'developer',
|
|
23
|
-
'entitlement',
|
|
24
|
-
'user'
|
|
25
|
-
]);
|
|
16
|
+
it("should have 'developer', 'entitlement' and 'user' keys", () => {
|
|
17
|
+
assert.containsAllKeys(featuresModel, ['developer', 'entitlement', 'user']);
|
|
26
18
|
});
|
|
27
19
|
});
|
|
28
20
|
|
|
@@ -58,7 +50,7 @@ describe('plugin-device', () => {
|
|
|
58
50
|
key = 'testKey';
|
|
59
51
|
model = new FeatureModel({
|
|
60
52
|
...dto.features[collectionName][0],
|
|
61
|
-
key
|
|
53
|
+
key,
|
|
62
54
|
});
|
|
63
55
|
spy = sinon.spy();
|
|
64
56
|
|