@webex/internal-plugin-device 2.59.2 → 2.59.3-next.1

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.
Files changed (41) hide show
  1. package/.eslintrc.js +6 -6
  2. package/README.md +80 -80
  3. package/babel.config.js +3 -3
  4. package/dist/config.js +27 -27
  5. package/dist/config.js.map +1 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/device.js +226 -226
  8. package/dist/device.js.map +1 -1
  9. package/dist/features/feature-collection.js +14 -14
  10. package/dist/features/feature-collection.js.map +1 -1
  11. package/dist/features/feature-model.js +73 -73
  12. package/dist/features/feature-model.js.map +1 -1
  13. package/dist/features/features-model.js +28 -28
  14. package/dist/features/features-model.js.map +1 -1
  15. package/dist/features/index.js.map +1 -1
  16. package/dist/index.js +4 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/interceptors/device-url.js +8 -8
  19. package/dist/interceptors/device-url.js.map +1 -1
  20. package/dist/metrics.js.map +1 -1
  21. package/jest.config.js +3 -3
  22. package/package.json +17 -16
  23. package/process +1 -1
  24. package/src/config.js +60 -60
  25. package/src/constants.js +23 -23
  26. package/src/device.js +835 -835
  27. package/src/features/feature-collection.js +30 -30
  28. package/src/features/feature-model.js +189 -189
  29. package/src/features/features-model.js +96 -96
  30. package/src/features/index.js +5 -5
  31. package/src/index.js +29 -29
  32. package/src/interceptors/device-url.js +61 -61
  33. package/src/metrics.js +5 -5
  34. package/test/integration/spec/device.js +904 -904
  35. package/test/integration/spec/webex.js +42 -42
  36. package/test/unit/spec/device.js +409 -409
  37. package/test/unit/spec/features/feature-collection.js +24 -24
  38. package/test/unit/spec/features/feature-model.js +255 -255
  39. package/test/unit/spec/features/features-model.js +97 -97
  40. package/test/unit/spec/interceptors/device-url.js +215 -215
  41. package/test/unit/spec/wdm-dto.json +104 -104
@@ -1,24 +1,24 @@
1
- import {assert} from '@webex/test-helper-chai';
2
- import {FeatureCollection, FeatureModel} from '@webex/internal-plugin-device';
3
-
4
- describe('plugin-device', () => {
5
- describe('feature-collection', () => {
6
- let featureCollection;
7
-
8
- beforeEach(() => {
9
- featureCollection = new FeatureCollection();
10
- });
11
-
12
- describe('#mainIndex', () => {
13
- it("should have its index set to 'key'", () => {
14
- assert.equal(featureCollection.mainIndex, 'key');
15
- });
16
- });
17
-
18
- describe('#model', () => {
19
- it("should have its model set to the 'FeatureModel' class", () => {
20
- assert.equal(featureCollection.model, FeatureModel);
21
- });
22
- });
23
- });
24
- });
1
+ import {assert} from '@webex/test-helper-chai';
2
+ import {FeatureCollection, FeatureModel} from '@webex/internal-plugin-device';
3
+
4
+ describe('plugin-device', () => {
5
+ describe('feature-collection', () => {
6
+ let featureCollection;
7
+
8
+ beforeEach(() => {
9
+ featureCollection = new FeatureCollection();
10
+ });
11
+
12
+ describe('#mainIndex', () => {
13
+ it("should have its index set to 'key'", () => {
14
+ assert.equal(featureCollection.mainIndex, 'key');
15
+ });
16
+ });
17
+
18
+ describe('#model', () => {
19
+ it("should have its model set to the 'FeatureModel' class", () => {
20
+ assert.equal(featureCollection.model, FeatureModel);
21
+ });
22
+ });
23
+ });
24
+ });
@@ -1,255 +1,255 @@
1
- import {assert} from '@webex/test-helper-chai';
2
- import {FeatureModel} from '@webex/internal-plugin-device';
3
-
4
- import dto from '../wdm-dto';
5
-
6
- describe('plugin-device', () => {
7
- describe('feature-model', () => {
8
- let featureLM;
9
- let featureNLM;
10
- let featureModel;
11
-
12
- beforeEach(() => {
13
- [featureLM, featureNLM] = dto.features.developer;
14
- });
15
-
16
- describe('#constructor()', () => {
17
- describe('when the feature includes a \'lastModified\' property', () => {
18
- beforeEach(() => {
19
- featureModel = new FeatureModel(featureLM);
20
- });
21
-
22
- it('should assign value attributes to properties', () => {
23
- assert.equal(featureLM.key, featureModel.key);
24
- assert.equal(featureLM.mutable, featureModel.mutable);
25
- assert.equal(featureLM.type, featureModel.type);
26
- assert.equal(featureLM.val, featureModel.val);
27
- assert.equal(featureLM.value, featureModel.value);
28
- });
29
-
30
- it("should assign the 'lastModified' value as a 'Date'", () => {
31
- assert.instanceOf(featureModel.lastModified, Date);
32
-
33
- assert.equal(featureModel.lastModified.toISOString(), featureLM.lastModified);
34
- });
35
- });
36
-
37
- describe('when the feature excludes a \'lastModified\' property', () => {
38
- beforeEach(() => {
39
- featureModel = new FeatureModel(featureNLM);
40
- });
41
-
42
- it('should assign value attributes to properties', () => {
43
- assert.equal(featureNLM.key, featureModel.key);
44
- assert.equal(featureNLM.mutable, featureModel.mutable);
45
- assert.equal(featureNLM.type, featureModel.type);
46
- assert.equal(featureNLM.val, featureModel.val);
47
- assert.equal(featureNLM.value, featureModel.value);
48
- });
49
-
50
- it("should not assign the 'lastModified' value", () => {
51
- assert.isUndefined(featureModel.lastModified);
52
- });
53
- });
54
- });
55
-
56
- describe('#parse()', () => {
57
- let fixture;
58
- let model;
59
-
60
- beforeEach(() => {
61
- featureModel = new FeatureModel();
62
- });
63
-
64
- it('should return an empty object when the model is not defined', () => {
65
- model = featureModel.parse(fixture);
66
- assert.deepEqual(model, {});
67
- });
68
-
69
- describe('when the model is defined', () => {
70
- beforeEach(() => {
71
- fixture = {};
72
- });
73
-
74
- describe('when the value is a number', () => {
75
- beforeEach(() => {
76
- fixture.val = '1234';
77
- model = featureModel.parse(fixture);
78
- });
79
-
80
- it('should set the value to a instance of number', () =>
81
- assert.typeOf(model.value, 'number'));
82
-
83
- it("should set the type to 'number'", () => assert.equal(model.type, 'number'));
84
-
85
- it('should set the model value to the equivalent Number value', () =>
86
- assert.equal(model.value, Number(fixture.val)));
87
- });
88
-
89
- describe('when the value is a true boolean', () => {
90
- beforeEach(() => {
91
- fixture.val = 'true';
92
- model = featureModel.parse(fixture);
93
- });
94
-
95
- it('should set the value to a boolean true', () => assert.equal(model.value, true));
96
-
97
- it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
98
- });
99
-
100
- describe('when the value is a True boolean', () => {
101
- beforeEach(() => {
102
- fixture.val = 'True';
103
- model = featureModel.parse(fixture);
104
- });
105
-
106
- it('should set the value to a boolean true', () => assert.equal(model.value, true));
107
-
108
- it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
109
- });
110
-
111
- describe('when the value is a false string', () => {
112
- beforeEach(() => {
113
- fixture.val = 'false';
114
- model = featureModel.parse(fixture);
115
- });
116
-
117
- it('should set the value to a boolean false', () => assert.equal(model.value, false));
118
-
119
- it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
120
- });
121
-
122
- describe('when the value is a False string', () => {
123
- beforeEach(() => {
124
- fixture.val = 'False';
125
- model = featureModel.parse(fixture);
126
- });
127
-
128
- it('should set the value to a boolean false', () => assert.equal(model.value, false));
129
-
130
- it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
131
- });
132
-
133
- describe('when the value is a string', () => {
134
- beforeEach(() => {
135
- fixture.val = 'hello world';
136
- model = featureModel.parse(fixture);
137
- });
138
-
139
- it('should set the value to a instance of string', () =>
140
- assert.typeOf(model.value, 'string'));
141
-
142
- it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
143
-
144
- it('should set the model value to the equivalent string value', () =>
145
- assert.equal(model.value, fixture.val));
146
- });
147
-
148
- describe('when the val is not a number, boolean or string', () => {
149
- beforeEach(() => {
150
- fixture.val = [1, 2, 3, 4];
151
- model = featureModel.parse(fixture);
152
- });
153
-
154
- it('should set the value to the provided val property', () =>
155
- assert.equal(model.value, fixture.val));
156
-
157
- it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
158
- });
159
-
160
- describe('when there is no value', () => {
161
- beforeEach(() => {
162
- fixture.val = undefined;
163
- model = featureModel.parse(fixture);
164
- });
165
-
166
- it('should set the value to undefined', () => assert.isUndefined(model.value));
167
-
168
- it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
169
- });
170
- });
171
- });
172
-
173
- describe('#serialize()', () => {
174
- let serialized;
175
-
176
- describe('when the feature includes a \'lastModified\' property', () => {
177
- beforeEach(() => {
178
- featureModel = new FeatureModel(featureLM);
179
- serialized = featureModel.serialize();
180
- });
181
-
182
- it('should assign value attributes to properties', () => {
183
- assert.equal(featureLM.key, serialized.key);
184
- assert.equal(featureLM.mutable, serialized.mutable);
185
- assert.equal(featureLM.type, serialized.type);
186
- assert.equal(featureLM.val, serialized.val);
187
- assert.equal(featureLM.value, serialized.value);
188
- });
189
-
190
- it("should assign the 'lastModified' value as a 'string'", () => {
191
- assert.typeOf(serialized.lastModified, 'string');
192
- assert.equal(serialized.lastModified, featureLM.lastModified);
193
- });
194
- });
195
-
196
- describe('when the feature excludes a \'lastModified\' property', () => {
197
- beforeEach(() => {
198
- featureModel = new FeatureModel(featureNLM);
199
- serialized = featureModel.serialize();
200
- });
201
-
202
- it('should assign value attributes to properties', () => {
203
- assert.equal(featureNLM.key, serialized.key);
204
- assert.equal(featureNLM.mutable, serialized.mutable);
205
- assert.equal(featureNLM.type, serialized.type);
206
- assert.equal(featureNLM.val, serialized.val);
207
- assert.equal(featureNLM.value, serialized.value);
208
- });
209
-
210
- it("should not assign the 'lastModified' value", () => {
211
- assert.isUndefined(serialized.lastModified);
212
- });
213
- });
214
- });
215
-
216
- describe('#set()', () => {
217
- describe('when setting only a single key', () => {
218
- let key;
219
- let value;
220
-
221
- beforeEach(() => {
222
- key = 'val';
223
- value = 'false';
224
- featureModel = new FeatureModel(featureLM);
225
- featureModel.set(key, value);
226
- });
227
-
228
- it('should assign the value to the appropriate key', () => {
229
- assert.equal(featureModel[key], value);
230
- });
231
-
232
- it('should not change other key values', () => {
233
- assert.equal(featureLM.key, featureModel.key);
234
- assert.equal(featureLM.mutable, featureModel.mutable);
235
- assert.equal(featureLM.type, featureModel.type);
236
- });
237
- });
238
-
239
- describe('when setting all properties', () => {
240
- beforeEach(() => {
241
- featureModel = new FeatureModel(featureLM);
242
- featureModel.set(featureNLM);
243
- });
244
-
245
- it('should assign all values', () => {
246
- assert.equal(featureNLM.key, featureModel.key);
247
- assert.equal(featureNLM.mutable, featureModel.mutable);
248
- assert.equal(featureNLM.type, featureModel.type);
249
- assert.equal(featureNLM.val, featureModel.val);
250
- assert.equal(featureNLM.value, featureModel.value);
251
- });
252
- });
253
- });
254
- });
255
- });
1
+ import {assert} from '@webex/test-helper-chai';
2
+ import {FeatureModel} from '@webex/internal-plugin-device';
3
+
4
+ import dto from '../wdm-dto';
5
+
6
+ describe('plugin-device', () => {
7
+ describe('feature-model', () => {
8
+ let featureLM;
9
+ let featureNLM;
10
+ let featureModel;
11
+
12
+ beforeEach(() => {
13
+ [featureLM, featureNLM] = dto.features.developer;
14
+ });
15
+
16
+ describe('#constructor()', () => {
17
+ describe('when the feature includes a \'lastModified\' property', () => {
18
+ beforeEach(() => {
19
+ featureModel = new FeatureModel(featureLM);
20
+ });
21
+
22
+ it('should assign value attributes to properties', () => {
23
+ assert.equal(featureLM.key, featureModel.key);
24
+ assert.equal(featureLM.mutable, featureModel.mutable);
25
+ assert.equal(featureLM.type, featureModel.type);
26
+ assert.equal(featureLM.val, featureModel.val);
27
+ assert.equal(featureLM.value, featureModel.value);
28
+ });
29
+
30
+ it("should assign the 'lastModified' value as a 'Date'", () => {
31
+ assert.instanceOf(featureModel.lastModified, Date);
32
+
33
+ assert.equal(featureModel.lastModified.toISOString(), featureLM.lastModified);
34
+ });
35
+ });
36
+
37
+ describe('when the feature excludes a \'lastModified\' property', () => {
38
+ beforeEach(() => {
39
+ featureModel = new FeatureModel(featureNLM);
40
+ });
41
+
42
+ it('should assign value attributes to properties', () => {
43
+ assert.equal(featureNLM.key, featureModel.key);
44
+ assert.equal(featureNLM.mutable, featureModel.mutable);
45
+ assert.equal(featureNLM.type, featureModel.type);
46
+ assert.equal(featureNLM.val, featureModel.val);
47
+ assert.equal(featureNLM.value, featureModel.value);
48
+ });
49
+
50
+ it("should not assign the 'lastModified' value", () => {
51
+ assert.isUndefined(featureModel.lastModified);
52
+ });
53
+ });
54
+ });
55
+
56
+ describe('#parse()', () => {
57
+ let fixture;
58
+ let model;
59
+
60
+ beforeEach(() => {
61
+ featureModel = new FeatureModel();
62
+ });
63
+
64
+ it('should return an empty object when the model is not defined', () => {
65
+ model = featureModel.parse(fixture);
66
+ assert.deepEqual(model, {});
67
+ });
68
+
69
+ describe('when the model is defined', () => {
70
+ beforeEach(() => {
71
+ fixture = {};
72
+ });
73
+
74
+ describe('when the value is a number', () => {
75
+ beforeEach(() => {
76
+ fixture.val = '1234';
77
+ model = featureModel.parse(fixture);
78
+ });
79
+
80
+ it('should set the value to a instance of number', () =>
81
+ assert.typeOf(model.value, 'number'));
82
+
83
+ it("should set the type to 'number'", () => assert.equal(model.type, 'number'));
84
+
85
+ it('should set the model value to the equivalent Number value', () =>
86
+ assert.equal(model.value, Number(fixture.val)));
87
+ });
88
+
89
+ describe('when the value is a true boolean', () => {
90
+ beforeEach(() => {
91
+ fixture.val = 'true';
92
+ model = featureModel.parse(fixture);
93
+ });
94
+
95
+ it('should set the value to a boolean true', () => assert.equal(model.value, true));
96
+
97
+ it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
98
+ });
99
+
100
+ describe('when the value is a True boolean', () => {
101
+ beforeEach(() => {
102
+ fixture.val = 'True';
103
+ model = featureModel.parse(fixture);
104
+ });
105
+
106
+ it('should set the value to a boolean true', () => assert.equal(model.value, true));
107
+
108
+ it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
109
+ });
110
+
111
+ describe('when the value is a false string', () => {
112
+ beforeEach(() => {
113
+ fixture.val = 'false';
114
+ model = featureModel.parse(fixture);
115
+ });
116
+
117
+ it('should set the value to a boolean false', () => assert.equal(model.value, false));
118
+
119
+ it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
120
+ });
121
+
122
+ describe('when the value is a False string', () => {
123
+ beforeEach(() => {
124
+ fixture.val = 'False';
125
+ model = featureModel.parse(fixture);
126
+ });
127
+
128
+ it('should set the value to a boolean false', () => assert.equal(model.value, false));
129
+
130
+ it("should set the type to 'boolean'", () => assert.equal(model.type, 'boolean'));
131
+ });
132
+
133
+ describe('when the value is a string', () => {
134
+ beforeEach(() => {
135
+ fixture.val = 'hello world';
136
+ model = featureModel.parse(fixture);
137
+ });
138
+
139
+ it('should set the value to a instance of string', () =>
140
+ assert.typeOf(model.value, 'string'));
141
+
142
+ it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
143
+
144
+ it('should set the model value to the equivalent string value', () =>
145
+ assert.equal(model.value, fixture.val));
146
+ });
147
+
148
+ describe('when the val is not a number, boolean or string', () => {
149
+ beforeEach(() => {
150
+ fixture.val = [1, 2, 3, 4];
151
+ model = featureModel.parse(fixture);
152
+ });
153
+
154
+ it('should set the value to the provided val property', () =>
155
+ assert.equal(model.value, fixture.val));
156
+
157
+ it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
158
+ });
159
+
160
+ describe('when there is no value', () => {
161
+ beforeEach(() => {
162
+ fixture.val = undefined;
163
+ model = featureModel.parse(fixture);
164
+ });
165
+
166
+ it('should set the value to undefined', () => assert.isUndefined(model.value));
167
+
168
+ it("should set the type to 'string'", () => assert.equal(model.type, 'string'));
169
+ });
170
+ });
171
+ });
172
+
173
+ describe('#serialize()', () => {
174
+ let serialized;
175
+
176
+ describe('when the feature includes a \'lastModified\' property', () => {
177
+ beforeEach(() => {
178
+ featureModel = new FeatureModel(featureLM);
179
+ serialized = featureModel.serialize();
180
+ });
181
+
182
+ it('should assign value attributes to properties', () => {
183
+ assert.equal(featureLM.key, serialized.key);
184
+ assert.equal(featureLM.mutable, serialized.mutable);
185
+ assert.equal(featureLM.type, serialized.type);
186
+ assert.equal(featureLM.val, serialized.val);
187
+ assert.equal(featureLM.value, serialized.value);
188
+ });
189
+
190
+ it("should assign the 'lastModified' value as a 'string'", () => {
191
+ assert.typeOf(serialized.lastModified, 'string');
192
+ assert.equal(serialized.lastModified, featureLM.lastModified);
193
+ });
194
+ });
195
+
196
+ describe('when the feature excludes a \'lastModified\' property', () => {
197
+ beforeEach(() => {
198
+ featureModel = new FeatureModel(featureNLM);
199
+ serialized = featureModel.serialize();
200
+ });
201
+
202
+ it('should assign value attributes to properties', () => {
203
+ assert.equal(featureNLM.key, serialized.key);
204
+ assert.equal(featureNLM.mutable, serialized.mutable);
205
+ assert.equal(featureNLM.type, serialized.type);
206
+ assert.equal(featureNLM.val, serialized.val);
207
+ assert.equal(featureNLM.value, serialized.value);
208
+ });
209
+
210
+ it("should not assign the 'lastModified' value", () => {
211
+ assert.isUndefined(serialized.lastModified);
212
+ });
213
+ });
214
+ });
215
+
216
+ describe('#set()', () => {
217
+ describe('when setting only a single key', () => {
218
+ let key;
219
+ let value;
220
+
221
+ beforeEach(() => {
222
+ key = 'val';
223
+ value = 'false';
224
+ featureModel = new FeatureModel(featureLM);
225
+ featureModel.set(key, value);
226
+ });
227
+
228
+ it('should assign the value to the appropriate key', () => {
229
+ assert.equal(featureModel[key], value);
230
+ });
231
+
232
+ it('should not change other key values', () => {
233
+ assert.equal(featureLM.key, featureModel.key);
234
+ assert.equal(featureLM.mutable, featureModel.mutable);
235
+ assert.equal(featureLM.type, featureModel.type);
236
+ });
237
+ });
238
+
239
+ describe('when setting all properties', () => {
240
+ beforeEach(() => {
241
+ featureModel = new FeatureModel(featureLM);
242
+ featureModel.set(featureNLM);
243
+ });
244
+
245
+ it('should assign all values', () => {
246
+ assert.equal(featureNLM.key, featureModel.key);
247
+ assert.equal(featureNLM.mutable, featureModel.mutable);
248
+ assert.equal(featureNLM.type, featureModel.type);
249
+ assert.equal(featureNLM.val, featureModel.val);
250
+ assert.equal(featureNLM.value, featureModel.value);
251
+ });
252
+ });
253
+ });
254
+ });
255
+ });