@@ -5,62 +5,188 @@ import {getDownloadURL} from '../src/download'
55jest . mock ( 'os' )
66const mockedOS = jest . mocked ( os )
77
8- test ( 'getDownloadURL Unix latest' , ( ) => {
9- mockedOS . platform . mockReturnValue ( 'linux' )
10-
11- const url = getDownloadURL ( 'latest' )
12-
13- expect ( url ) . toBe (
14- 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64'
15- )
16- } )
17-
18- test ( 'getDownloadURL Windows latest' , ( ) => {
19- mockedOS . platform . mockReturnValue ( 'win32' )
20-
21- const url = getDownloadURL ( 'latest' )
22-
23- expect ( url ) . toBe (
24- 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe'
25- )
26- } )
27-
28- test ( 'getDownloadURL Unix head' , ( ) => {
29- mockedOS . platform . mockReturnValue ( 'linux' )
30-
31- const url = getDownloadURL ( 'head' )
32-
33- expect ( url ) . toBe (
34- 'https://storage.googleapis.com/minikube-builds/master/minikube-linux-amd64'
35- )
8+ test ( 'getDownloadURL Linux' , ( ) => {
9+ const tests = [
10+ {
11+ arch : 'x64' ,
12+ version : 'latest' ,
13+ expected :
14+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64' ,
15+ } ,
16+ {
17+ arch : 'arm64' ,
18+ version : 'latest' ,
19+ expected :
20+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-arm64' ,
21+ } ,
22+ {
23+ arch : 'arm' ,
24+ version : 'latest' ,
25+ expected :
26+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-arm' ,
27+ } ,
28+ {
29+ arch : 's390x' ,
30+ version : 'latest' ,
31+ expected :
32+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-s390x' ,
33+ } ,
34+ {
35+ arch : 'ppc64' ,
36+ version : 'latest' ,
37+ expected :
38+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-ppc64le' ,
39+ } ,
40+ {
41+ arch : 'x64' ,
42+ version : 'head' ,
43+ expected :
44+ 'https://storage.googleapis.com/minikube-builds/master/minikube-linux-amd64' ,
45+ } ,
46+ {
47+ arch : 'arm64' ,
48+ version : 'head' ,
49+ expected :
50+ 'https://storage.googleapis.com/minikube-builds/master/minikube-linux-arm64' ,
51+ } ,
52+ {
53+ arch : 'arm' ,
54+ version : 'head' ,
55+ expected :
56+ 'https://storage.googleapis.com/minikube-builds/master/minikube-linux-arm' ,
57+ } ,
58+ {
59+ arch : 's390x' ,
60+ version : 'head' ,
61+ expected :
62+ 'https://storage.googleapis.com/minikube-builds/master/minikube-linux-s390x' ,
63+ } ,
64+ {
65+ arch : 'ppc64' ,
66+ version : 'head' ,
67+ expected :
68+ 'https://storage.googleapis.com/minikube-builds/master/minikube-linux-ppc64le' ,
69+ } ,
70+ {
71+ arch : 'x64' ,
72+ version : '1.28.0' ,
73+ expected :
74+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-amd64' ,
75+ } ,
76+ {
77+ arch : 'arm64' ,
78+ version : '1.28.0' ,
79+ expected :
80+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-arm64' ,
81+ } ,
82+ {
83+ arch : 'arm' ,
84+ version : '1.28.0' ,
85+ expected :
86+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-arm' ,
87+ } ,
88+ {
89+ arch : 's390x' ,
90+ version : '1.28.0' ,
91+ expected :
92+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-s390x' ,
93+ } ,
94+ {
95+ arch : 'ppc64' ,
96+ version : '1.28.0' ,
97+ expected :
98+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-ppc64le' ,
99+ } ,
100+ ]
101+
102+ for ( const tc of tests ) {
103+ mockedOS . arch . mockReturnValue ( tc . arch )
104+ mockedOS . platform . mockReturnValue ( 'linux' )
105+
106+ const url = getDownloadURL ( tc . version )
107+
108+ expect ( url ) . toBe ( tc . expected )
109+ }
36110} )
37111
38- test ( 'getDownloadURL Windows head' , ( ) => {
39- mockedOS . platform . mockReturnValue ( 'win32' )
40-
41- const url = getDownloadURL ( 'head' )
42-
43- expect ( url ) . toBe (
44- 'https://storage.googleapis.com/minikube-builds/master/minikube-windows-amd64.exe'
45- )
112+ test ( 'getDownloadURL macOS' , ( ) => {
113+ const tests = [
114+ {
115+ arch : 'x64' ,
116+ version : 'latest' ,
117+ expected :
118+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-darwin-amd64' ,
119+ } ,
120+ {
121+ arch : 'arm64' ,
122+ version : 'latest' ,
123+ expected :
124+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-darwin-arm64' ,
125+ } ,
126+ {
127+ arch : 'x64' ,
128+ version : 'head' ,
129+ expected :
130+ 'https://storage.googleapis.com/minikube-builds/master/minikube-darwin-amd64' ,
131+ } ,
132+ {
133+ arch : 'arm64' ,
134+ version : 'head' ,
135+ expected :
136+ 'https://storage.googleapis.com/minikube-builds/master/minikube-darwin-arm64' ,
137+ } ,
138+ {
139+ arch : 'x64' ,
140+ version : '1.28.0' ,
141+ expected :
142+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-darwin-amd64' ,
143+ } ,
144+ {
145+ arch : 'arm64' ,
146+ version : '1.28.0' ,
147+ expected :
148+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-darwin-arm64' ,
149+ } ,
150+ ]
151+
152+ for ( const tc of tests ) {
153+ mockedOS . arch . mockReturnValue ( tc . arch )
154+ mockedOS . platform . mockReturnValue ( 'darwin' )
155+
156+ const url = getDownloadURL ( tc . version )
157+
158+ expect ( url ) . toBe ( tc . expected )
159+ }
46160} )
47161
48- test ( 'getDownloadURL Unix version' , ( ) => {
49- mockedOS . platform . mockReturnValue ( 'linux' )
50-
51- const url = getDownloadURL ( '1.28.0' )
52-
53- expect ( url ) . toBe (
54- 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-linux-amd64'
55- )
56- } )
57-
58- test ( 'getDownloadURL Windows version' , ( ) => {
59- mockedOS . platform . mockReturnValue ( 'win32' )
60-
61- const url = getDownloadURL ( '1.28.0' )
62-
63- expect ( url ) . toBe (
64- 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-windows-amd64.exe'
65- )
162+ test ( 'getDownloadURL Windows' , ( ) => {
163+ const tests = [
164+ {
165+ arch : 'x64' ,
166+ version : 'latest' ,
167+ expected :
168+ 'https://github.com/kubernetes/minikube/releases/latest/download/minikube-windows-amd64.exe' ,
169+ } ,
170+ {
171+ arch : 'x64' ,
172+ version : 'head' ,
173+ expected :
174+ 'https://storage.googleapis.com/minikube-builds/master/minikube-windows-amd64.exe' ,
175+ } ,
176+ {
177+ arch : 'x64' ,
178+ version : '1.28.0' ,
179+ expected :
180+ 'https://github.com/kubernetes/minikube/releases/download/v1.28.0/minikube-windows-amd64.exe' ,
181+ } ,
182+ ]
183+
184+ for ( const tc of tests ) {
185+ mockedOS . arch . mockReturnValue ( tc . arch )
186+ mockedOS . platform . mockReturnValue ( 'win32' )
187+
188+ const url = getDownloadURL ( tc . version )
189+
190+ expect ( url ) . toBe ( tc . expected )
191+ }
66192} )
0 commit comments