-
-
Notifications
You must be signed in to change notification settings - Fork 658
/
findOutdatedSdks.test.ts
65 lines (59 loc) · 2.03 KB
/
findOutdatedSdks.test.ts
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { findOutdatedSDKs } from './findOutdatedSdks';
describe('findOutdatedSDKs', () => {
it('should return an empty array when all SDKs are up to date', () => {
const sdkVersions = [
'unleash-client-node:6.0.0',
'unleash-client-php:3.0.0',
];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([]);
});
it('should return an array with outdated SDKs', () => {
const sdkVersions = [
'unleash-client-node:3.9.9',
'unleash-client-php:0.9.9',
];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([
'unleash-client-node:3.9.9',
'unleash-client-php:0.9.9',
]);
});
it('should ignore SDKs not in the config', () => {
const sdkVersions = ['unleash-client-pony:2.0.0'];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([]);
});
it('should handle and remove duplicate SDK versions', () => {
const sdkVersions = [
'unleash-client-node:3.8.0',
'unleash-client-node:3.8.0',
'unleash-client-php:0.9.0',
'unleash-client-php:0.9.0',
];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([
'unleash-client-node:3.8.0',
'unleash-client-php:0.9.0',
]);
});
it('should correctly handle semver versions', () => {
const sdkVersions = [
'unleash-client-node:6.1.0',
'unleash-client-php:3.20.3-beta.0',
];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([]);
});
it('should ignore invalid SDK versions', () => {
const sdkVersions = [
'unleash-client-node',
'1.2.3',
'unleash-client-node:0.0',
'unleash-client-node:development',
null,
];
const result = findOutdatedSDKs(sdkVersions);
expect(result).toEqual([]);
});
});