-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
Copy pathClientSDK.spec.js
49 lines (44 loc) · 1.05 KB
/
ClientSDK.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const ClientSDK = require('../lib/ClientSDK');
describe('ClientSDK', () => {
it('should properly parse the SDK versions', () => {
const clientSDKFromVersion = ClientSDK.fromString;
expect(clientSDKFromVersion('i1.1.1')).toEqual({
sdk: 'i',
version: '1.1.1',
});
expect(clientSDKFromVersion('i1')).toEqual({
sdk: 'i',
version: '1',
});
expect(clientSDKFromVersion('apple-tv1.13.0')).toEqual({
sdk: 'apple-tv',
version: '1.13.0',
});
expect(clientSDKFromVersion('js1.9.0')).toEqual({
sdk: 'js',
version: '1.9.0',
});
});
it('should properly sastisfy', () => {
expect(
ClientSDK.compatible({
js: '>=1.9.0',
})('js1.9.0')
).toBe(true);
expect(
ClientSDK.compatible({
js: '>=1.9.0',
})('js2.0.0')
).toBe(true);
expect(
ClientSDK.compatible({
js: '>=1.9.0',
})('js1.8.0')
).toBe(false);
expect(
ClientSDK.compatible({
js: '>=1.9.0',
})(undefined)
).toBe(true);
});
});