@@ -22,6 +22,11 @@ describe('isReady script', () => {
22
22
const state = JSON . stringify ( { status : 'ready' , containers : { } } )
23
23
process . argv = [ ] ;
24
24
proxyquire ( '../lib/isReady.js' , {
25
+ '@codefresh-io/cf-telemetry/init' : {
26
+ terminate : ( ) => ( {
27
+ finally : callback => callback ( ) ,
28
+ } )
29
+ } ,
25
30
'fs' : {
26
31
readFileSync : ( ) => Buffer . from ( state ) ,
27
32
} ,
@@ -32,6 +37,11 @@ describe('isReady script', () => {
32
37
const state = JSON . stringify ( { status : 'notReady' , containers : { } } )
33
38
process . argv = [ ] ;
34
39
proxyquire ( '../lib/isReady.js' , {
40
+ '@codefresh-io/cf-telemetry/init' : {
41
+ terminate : ( ) => ( {
42
+ finally : callback => callback ( ) ,
43
+ } )
44
+ } ,
35
45
'fs' : {
36
46
readFileSync : ( ) => Buffer . from ( state ) ,
37
47
} ,
@@ -44,6 +54,11 @@ describe('isReady script', () => {
44
54
const state = JSON . stringify ( { status : 'ready' , containers : { 'container-id' : { status : ContainerHandlingStatus . LISTENING } } } )
45
55
process . argv = [ 'foo' , 'bar' , 'container-id' ] ;
46
56
proxyquire ( '../lib/isReady.js' , {
57
+ '@codefresh-io/cf-telemetry/init' : {
58
+ terminate : ( ) => ( {
59
+ finally : callback => callback ( ) ,
60
+ } )
61
+ } ,
47
62
'fs' : {
48
63
readFileSync : ( ) => Buffer . from ( state ) ,
49
64
} ,
@@ -54,6 +69,11 @@ describe('isReady script', () => {
54
69
const state = JSON . stringify ( { status : 'ready' , containers : { 'container-id' : { status : ContainerHandlingStatus . WAITING_FOR_START } } } )
55
70
process . argv = [ 'foo' , 'bar' , 'container-id' ] ;
56
71
proxyquire ( '../lib/isReady.js' , {
72
+ '@codefresh-io/cf-telemetry/init' : {
73
+ terminate : ( ) => ( {
74
+ finally : callback => callback ( ) ,
75
+ } )
76
+ } ,
57
77
'fs' : {
58
78
readFileSync : ( ) => Buffer . from ( state ) ,
59
79
} ,
@@ -64,6 +84,11 @@ describe('isReady script', () => {
64
84
const state = JSON . stringify ( { status : 'ready' , containers : { 'container-id' : { status : ContainerHandlingStatus . FINISHED } } } )
65
85
process . argv = [ 'foo' , 'bar' , 'container-id' ] ;
66
86
proxyquire ( '../lib/isReady.js' , {
87
+ '@codefresh-io/cf-telemetry/init' : {
88
+ terminate : ( ) => ( {
89
+ finally : callback => callback ( ) ,
90
+ } )
91
+ } ,
67
92
'fs' : {
68
93
readFileSync : ( ) => Buffer . from ( state ) ,
69
94
} ,
@@ -74,11 +99,16 @@ describe('isReady script', () => {
74
99
const state = JSON . stringify ( { status : 'ready' , containers : { 'container-id' : { status : ContainerHandlingStatus . INITIALIZING } } } )
75
100
process . argv = [ 'foo' , 'bar' , 'container-id' ] ;
76
101
proxyquire ( '../lib/isReady.js' , {
102
+ '@codefresh-io/cf-telemetry/init' : {
103
+ terminate : ( ) => ( {
104
+ finally : callback => callback ( ) ,
105
+ } )
106
+ } ,
77
107
'fs' : {
78
108
readFileSync : ( ) => Buffer . from ( state ) ,
79
109
} ,
80
110
} ) ;
81
111
expect ( process . exit ) . to . have . been . calledOnceWith ( 1 ) ;
82
112
} ) ;
83
113
} ) ;
84
- } ) ;
114
+ } ) ;
0 commit comments