@@ -9,7 +9,7 @@ describe('Kubectl path', () => {
99 const path = 'path'
1010
1111 it ( 'gets the kubectl path' , async ( ) => {
12- jest . spyOn ( core , 'getInput' ) . mockImplementationOnce ( ( ) => undefined )
12+ jest . spyOn ( core , 'getInput' ) . mockImplementationOnce ( ( ) => '' )
1313 jest . spyOn ( io , 'which' ) . mockImplementationOnce ( async ( ) => path )
1414
1515 expect ( await getKubectlPath ( ) ) . toBe ( path )
@@ -24,12 +24,12 @@ describe('Kubectl path', () => {
2424
2525 it ( 'throws if kubectl not found' , async ( ) => {
2626 // without version
27- jest . spyOn ( io , 'which' ) . mockImplementationOnce ( async ( ) => undefined )
27+ jest . spyOn ( io , 'which' ) . mockImplementationOnce ( async ( ) => '' )
2828 await expect ( ( ) => getKubectlPath ( ) ) . rejects . toThrow ( )
2929
3030 // with verision
31- jest . spyOn ( core , 'getInput' ) . mockImplementationOnce ( ( ) => undefined )
32- jest . spyOn ( io , 'which' ) . mockImplementationOnce ( async ( ) => undefined )
31+ jest . spyOn ( core , 'getInput' ) . mockImplementationOnce ( ( ) => '' )
32+ jest . spyOn ( io , 'which' ) . mockImplementationOnce ( async ( ) => '' )
3333 await expect ( ( ) => getKubectlPath ( ) ) . rejects . toThrow ( )
3434 } )
3535} )
@@ -53,7 +53,7 @@ describe('Kubectl class', () => {
5353 const configPaths = 'configPaths'
5454 const result = await kubectl . apply ( configPaths )
5555 expect ( result ) . toBe ( execReturn )
56- expect ( exec . getExecOutput ) . toBeCalledWith (
56+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
5757 kubectlPath ,
5858 [ 'apply' , '-f' , configPaths , '--namespace' , testNamespace ] ,
5959 { silent : false }
@@ -64,7 +64,7 @@ describe('Kubectl class', () => {
6464 const configPaths = [ 'configPath1' , 'configPath2' , 'configPath3' ]
6565 const result = await kubectl . apply ( configPaths )
6666 expect ( result ) . toBe ( execReturn )
67- expect ( exec . getExecOutput ) . toBeCalledWith (
67+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
6868 kubectlPath ,
6969 [
7070 'apply' ,
@@ -81,7 +81,7 @@ describe('Kubectl class', () => {
8181 const configPaths = [ 'configPath1' , 'configPath2' , 'configPath3' ]
8282 const result = await kubectl . apply ( configPaths , true )
8383 expect ( result ) . toBe ( execReturn )
84- expect ( exec . getExecOutput ) . toBeCalledWith (
84+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
8585 kubectlPath ,
8686 [
8787 'apply' ,
@@ -100,7 +100,7 @@ describe('Kubectl class', () => {
100100 const resourceName = 'name'
101101 const result = await kubectl . describe ( resourceType , resourceName )
102102 expect ( result ) . toBe ( execReturn )
103- expect ( exec . getExecOutput ) . toBeCalledWith (
103+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
104104 kubectlPath ,
105105 [
106106 'describe' ,
@@ -120,7 +120,7 @@ describe('Kubectl class', () => {
120120 silent ,
121121 otherNamespace
122122 )
123- expect ( exec . getExecOutput ) . toBeCalledWith (
123+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
124124 kubectlPath ,
125125 [
126126 'describe' ,
@@ -138,7 +138,7 @@ describe('Kubectl class', () => {
138138 const resourceName = 'name'
139139 const result = await kubectl . describe ( resourceType , resourceName , true )
140140 expect ( result ) . toBe ( execReturn )
141- expect ( exec . getExecOutput ) . toBeCalledWith (
141+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
142142 kubectlPath ,
143143 [
144144 'describe' ,
@@ -158,7 +158,7 @@ describe('Kubectl class', () => {
158158 silent ,
159159 otherNamespace
160160 )
161- expect ( exec . getExecOutput ) . toBeCalledWith (
161+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
162162 kubectlPath ,
163163 [
164164 'describe' ,
@@ -181,7 +181,7 @@ describe('Kubectl class', () => {
181181 annotation
182182 )
183183 expect ( result ) . toBe ( execReturn )
184- expect ( exec . getExecOutput ) . toBeCalledWith (
184+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
185185 kubectlPath ,
186186 [
187187 'annotate' ,
@@ -202,7 +202,7 @@ describe('Kubectl class', () => {
202202 annotation ,
203203 otherNamespace
204204 )
205- expect ( exec . getExecOutput ) . toBeCalledWith (
205+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
206206 kubectlPath ,
207207 [
208208 'annotate' ,
@@ -222,7 +222,7 @@ describe('Kubectl class', () => {
222222 const annotation = 'annotation'
223223 const result = await kubectl . annotateFiles ( file , annotation )
224224 expect ( result ) . toBe ( execReturn )
225- expect ( exec . getExecOutput ) . toBeCalledWith (
225+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
226226 kubectlPath ,
227227 [
228228 'annotate' ,
@@ -238,7 +238,7 @@ describe('Kubectl class', () => {
238238
239239 // override ns
240240 await kubectl . annotateFiles ( file , annotation , otherNamespace )
241- expect ( exec . getExecOutput ) . toBeCalledWith (
241+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
242242 kubectlPath ,
243243 [
244244 'annotate' ,
@@ -258,7 +258,7 @@ describe('Kubectl class', () => {
258258 const annotation = 'annotation'
259259 const result = await kubectl . annotateFiles ( files , annotation )
260260 expect ( result ) . toBe ( execReturn )
261- expect ( exec . getExecOutput ) . toBeCalledWith (
261+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
262262 kubectlPath ,
263263 [
264264 'annotate' ,
@@ -274,7 +274,7 @@ describe('Kubectl class', () => {
274274
275275 // override ns
276276 await kubectl . annotateFiles ( files , annotation , otherNamespace )
277- expect ( exec . getExecOutput ) . toBeCalledWith (
277+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
278278 kubectlPath ,
279279 [
280280 'annotate' ,
@@ -294,7 +294,7 @@ describe('Kubectl class', () => {
294294 const labels = [ 'label1' , 'label2' ]
295295 const result = await kubectl . labelFiles ( file , labels )
296296 expect ( result ) . toBe ( execReturn )
297- expect ( exec . getExecOutput ) . toBeCalledWith (
297+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
298298 kubectlPath ,
299299 [
300300 'label' ,
@@ -309,7 +309,7 @@ describe('Kubectl class', () => {
309309 )
310310
311311 await kubectl . labelFiles ( file , labels , otherNamespace )
312- expect ( exec . getExecOutput ) . toBeCalledWith (
312+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
313313 kubectlPath ,
314314 [
315315 'label' ,
@@ -329,7 +329,7 @@ describe('Kubectl class', () => {
329329 const labels = [ 'label1' , 'label2' ]
330330 const result = await kubectl . labelFiles ( files , labels )
331331 expect ( result ) . toBe ( execReturn )
332- expect ( exec . getExecOutput ) . toBeCalledWith (
332+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
333333 kubectlPath ,
334334 [
335335 'label' ,
@@ -344,7 +344,7 @@ describe('Kubectl class', () => {
344344 )
345345
346346 await kubectl . labelFiles ( files , labels , otherNamespace )
347- expect ( exec . getExecOutput ) . toBeCalledWith (
347+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
348348 kubectlPath ,
349349 [
350350 'label' ,
@@ -361,7 +361,7 @@ describe('Kubectl class', () => {
361361
362362 it ( 'gets all pods' , async ( ) => {
363363 expect ( await kubectl . getAllPods ( ) ) . toBe ( execReturn )
364- expect ( exec . getExecOutput ) . toBeCalledWith (
364+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
365365 kubectlPath ,
366366 [ 'get' , 'pods' , '-o' , 'json' , '--namespace' , testNamespace ] ,
367367 { silent : true }
@@ -374,7 +374,7 @@ describe('Kubectl class', () => {
374374 expect ( await kubectl . checkRolloutStatus ( resourceType , name ) ) . toBe (
375375 execReturn
376376 )
377- expect ( exec . getExecOutput ) . toBeCalledWith (
377+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
378378 kubectlPath ,
379379 [
380380 'rollout' ,
@@ -388,7 +388,7 @@ describe('Kubectl class', () => {
388388
389389 // override ns
390390 await kubectl . checkRolloutStatus ( resourceType , name , otherNamespace )
391- expect ( exec . getExecOutput ) . toBeCalledWith (
391+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
392392 kubectlPath ,
393393 [
394394 'rollout' ,
@@ -405,7 +405,7 @@ describe('Kubectl class', () => {
405405 const resourceType = 'type'
406406 const name = 'name'
407407 expect ( await kubectl . getResource ( resourceType , name ) ) . toBe ( execReturn )
408- expect ( exec . getExecOutput ) . toBeCalledWith (
408+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
409409 kubectlPath ,
410410 [
411411 'get' ,
@@ -421,7 +421,7 @@ describe('Kubectl class', () => {
421421 // override ns
422422 const silent = true
423423 await kubectl . getResource ( resourceType , name , silent , otherNamespace )
424- expect ( exec . getExecOutput ) . toBeCalledWith (
424+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
425425 kubectlPath ,
426426 [
427427 'get' ,
@@ -439,7 +439,7 @@ describe('Kubectl class', () => {
439439 // no args
440440 const command = 'command'
441441 expect ( await kubectl . executeCommand ( command ) ) . toBe ( execReturn )
442- expect ( exec . getExecOutput ) . toBeCalledWith (
442+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
443443 kubectlPath ,
444444 [ command , '--namespace' , testNamespace ] ,
445445 { silent : false }
@@ -448,7 +448,7 @@ describe('Kubectl class', () => {
448448 // with args
449449 const args = 'args'
450450 expect ( await kubectl . executeCommand ( command , args ) ) . toBe ( execReturn )
451- expect ( exec . getExecOutput ) . toBeCalledWith (
451+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
452452 kubectlPath ,
453453 [ command , args , '--namespace' , testNamespace ] ,
454454 { silent : false }
@@ -458,15 +458,15 @@ describe('Kubectl class', () => {
458458 it ( 'deletes with single argument' , async ( ) => {
459459 const arg = 'argument'
460460 expect ( await kubectl . delete ( arg ) ) . toBe ( execReturn )
461- expect ( exec . getExecOutput ) . toBeCalledWith (
461+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
462462 kubectlPath ,
463463 [ 'delete' , arg , '--namespace' , testNamespace ] ,
464464 { silent : false }
465465 )
466466
467467 // override ns
468468 await kubectl . delete ( arg , otherNamespace )
469- expect ( exec . getExecOutput ) . toBeCalledWith (
469+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
470470 kubectlPath ,
471471 [ 'delete' , arg , '--namespace' , otherNamespace ] ,
472472 { silent : false }
@@ -476,15 +476,15 @@ describe('Kubectl class', () => {
476476 it ( 'deletes with multiple arguments' , async ( ) => {
477477 const args = [ 'argument1' , 'argument2' , 'argument3' ]
478478 expect ( await kubectl . delete ( args ) ) . toBe ( execReturn )
479- expect ( exec . getExecOutput ) . toBeCalledWith (
479+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
480480 kubectlPath ,
481481 [ 'delete' , ...args , '--namespace' , testNamespace ] ,
482482 { silent : false }
483483 )
484484
485485 // override ns
486486 await kubectl . delete ( args , otherNamespace )
487- expect ( exec . getExecOutput ) . toBeCalledWith (
487+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
488488 kubectlPath ,
489489 [ 'delete' , ...args , '--namespace' , otherNamespace ] ,
490490 { silent : false }
@@ -522,15 +522,15 @@ describe('Kubectl class', () => {
522522
523523 const command = 'command'
524524 kubectl . executeCommand ( command )
525- expect ( exec . getExecOutput ) . toBeCalledWith (
525+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith (
526526 kubectlPath ,
527527 [ command , '--insecure-skip-tls-verify' , '--namespace' , testNamespace ] ,
528528 { silent : false }
529529 )
530530
531531 const kubectlNoFlags = new Kubectl ( kubectlPath )
532532 kubectlNoFlags . executeCommand ( command )
533- expect ( exec . getExecOutput ) . toBeCalledWith ( kubectlPath , [ command ] , {
533+ expect ( exec . getExecOutput ) . toHaveBeenCalledWith ( kubectlPath , [ command ] , {
534534 silent : false
535535 } )
536536 } )
0 commit comments