forked from renovatebot/renovate
/
extract.spec.ts
114 lines (109 loc) · 3.14 KB
/
extract.spec.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { codeBlock } from 'common-tags';
import { extractPackageFile } from '.';
describe('modules/manager/mint/extract', () => {
describe('extractPackageFile()', () => {
it('Mintfile With Version Description', () => {
const res = extractPackageFile(codeBlock`
SwiftGen/SwiftGen@6.6.1
yonaskolb/xcodegen@2.30.0
realm/SwiftLint @ 0.48.0
#realm/SwiftLint @ 0.48.0
`);
expect(res).toEqual({
deps: [
{
depName: 'SwiftGen/SwiftGen',
currentValue: '6.6.1',
datasource: 'git-tags',
packageName: 'https://github.com/SwiftGen/SwiftGen.git',
},
{
depName: 'yonaskolb/xcodegen',
currentValue: '2.30.0',
datasource: 'git-tags',
packageName: 'https://github.com/yonaskolb/xcodegen.git',
},
{
depName: 'realm/SwiftLint',
currentValue: '0.48.0',
datasource: 'git-tags',
packageName: 'https://github.com/realm/SwiftLint.git',
},
],
});
});
it('Mintfile Without Version Description', () => {
const res = extractPackageFile(codeBlock`
yonaskolb/xcodegen
realm/SwiftLint
`);
expect(res).toEqual({
deps: [
{
depName: 'yonaskolb/xcodegen',
skipReason: 'unspecified-version',
},
{
depName: 'realm/SwiftLint',
skipReason: 'unspecified-version',
},
],
});
});
it('Complex Mintfile', () => {
const res = extractPackageFile(codeBlock`
SwiftGen/SwiftGen@6.6.1
yonaskolb/xcodegen
realm/SwiftLint @ 0.48.0
`);
expect(res).toEqual({
deps: [
{
depName: 'SwiftGen/SwiftGen',
currentValue: '6.6.1',
datasource: 'git-tags',
packageName: 'https://github.com/SwiftGen/SwiftGen.git',
},
{
depName: 'yonaskolb/xcodegen',
skipReason: 'unspecified-version',
},
{
depName: 'realm/SwiftLint',
currentValue: '0.48.0',
datasource: 'git-tags',
packageName: 'https://github.com/realm/SwiftLint.git',
},
],
});
});
it('Mintfile Includes Commented Out', () => {
const res = extractPackageFile(codeBlock`
SwiftGen/SwiftGen@6.6.1
yonaskolb/xcodegen
#yonaskolb/xcodegen
realm/SwiftLint@0.48.0 #commented out
`);
expect(res).toEqual({
deps: [
{
depName: 'SwiftGen/SwiftGen',
currentValue: '6.6.1',
datasource: 'git-tags',
packageName: 'https://github.com/SwiftGen/SwiftGen.git',
},
{
depName: 'yonaskolb/xcodegen',
skipReason: 'unspecified-version',
},
{
depName: 'realm/SwiftLint',
currentValue: '0.48.0',
datasource: 'git-tags',
packageName: 'https://github.com/realm/SwiftLint.git',
},
],
});
});
});
});