@@ -65,16 +65,14 @@ describe("test execute function", () => {
65
65
expect ( exitFn . mock . calls ) . toEqual ( [ [ 1 ] ] ) ;
66
66
} ) ;
67
67
it ( "[+ve]: with deployment table and p1 values" , async ( ) => {
68
- jest . spyOn ( azure , "addSrcToACRPipeline" ) . mockReturnValueOnce (
69
- Promise . resolve ( {
70
- PartitionKey : uuid ( ) ,
71
- RowKey : uuid ( ) ,
72
- commitId : uuid ( ) ,
73
- imageTag : uuid ( ) ,
74
- p1 : uuid ( ) ,
75
- service : uuid ( ) ,
76
- } )
77
- ) ;
68
+ jest . spyOn ( azure , "addSrcToACRPipeline" ) . mockResolvedValueOnce ( {
69
+ PartitionKey : uuid ( ) ,
70
+ RowKey : uuid ( ) ,
71
+ commitId : uuid ( ) ,
72
+ imageTag : uuid ( ) ,
73
+ p1 : uuid ( ) ,
74
+ service : uuid ( ) ,
75
+ } ) ;
78
76
const exitFn = jest . fn ( ) ;
79
77
80
78
const vals = getMockedValues ( true ) ;
@@ -90,7 +88,7 @@ describe("test execute function", () => {
90
88
it ( "[-ve]: with deployment table and p1 values; addSrcToACRPipeline fails" , async ( ) => {
91
89
jest
92
90
. spyOn ( azure , "addSrcToACRPipeline" )
93
- . mockReturnValueOnce ( Promise . reject ( ) ) ;
91
+ . mockRejectedValueOnce ( Error ( "fake error" ) ) ;
94
92
const exitFn = jest . fn ( ) ;
95
93
96
94
const vals = getMockedValues ( true ) ;
@@ -112,19 +110,17 @@ describe("test execute function", () => {
112
110
expect ( exitFn . mock . calls ) . toEqual ( [ [ 1 ] ] ) ;
113
111
} ) ;
114
112
it ( "[+ve]: with deployment table and p2 values" , async ( ) => {
115
- jest . spyOn ( azure , "updateACRToHLDPipeline" ) . mockReturnValueOnce (
116
- Promise . resolve ( {
117
- PartitionKey : uuid ( ) ,
118
- RowKey : uuid ( ) ,
119
- commitId : uuid ( ) ,
120
- env : uuid ( ) ,
121
- hldCommitId : uuid ( ) ,
122
- imageTag : uuid ( ) ,
123
- p1 : uuid ( ) ,
124
- p2 : uuid ( ) ,
125
- service : uuid ( ) ,
126
- } )
127
- ) ;
113
+ jest . spyOn ( azure , "updateACRToHLDPipeline" ) . mockResolvedValueOnce ( {
114
+ PartitionKey : uuid ( ) ,
115
+ RowKey : uuid ( ) ,
116
+ commitId : uuid ( ) ,
117
+ env : uuid ( ) ,
118
+ hldCommitId : uuid ( ) ,
119
+ imageTag : uuid ( ) ,
120
+ p1 : uuid ( ) ,
121
+ p2 : uuid ( ) ,
122
+ service : uuid ( ) ,
123
+ } ) ;
128
124
const exitFn = jest . fn ( ) ;
129
125
130
126
const vals = getMockedValues ( true ) ;
@@ -140,7 +136,7 @@ describe("test execute function", () => {
140
136
it ( "[-ve]: with deployment table and p2 values; updateACRToHLDPipeline fails" , async ( ) => {
141
137
jest
142
138
. spyOn ( azure , "updateACRToHLDPipeline" )
143
- . mockReturnValueOnce ( Promise . reject ( ) ) ;
139
+ . mockRejectedValueOnce ( Error ( "fake error" ) ) ;
144
140
const exitFn = jest . fn ( ) ;
145
141
146
142
const vals = getMockedValues ( true ) ;
@@ -154,20 +150,18 @@ describe("test execute function", () => {
154
150
expect ( exitFn . mock . calls ) . toEqual ( [ [ 1 ] ] ) ;
155
151
} ) ;
156
152
it ( "[+ve]: with deployment table and p3 values and hldCommitId values" , async ( ) => {
157
- jest . spyOn ( azure , "updateHLDToManifestPipeline" ) . mockReturnValueOnce (
158
- Promise . resolve ( {
159
- PartitionKey : uuid ( ) ,
160
- RowKey : uuid ( ) ,
161
- commitId : uuid ( ) ,
162
- env : uuid ( ) ,
163
- hldCommitId : uuid ( ) ,
164
- imageTag : uuid ( ) ,
165
- p1 : uuid ( ) ,
166
- p2 : uuid ( ) ,
167
- p3 : uuid ( ) ,
168
- service : uuid ( ) ,
169
- } )
170
- ) ;
153
+ jest . spyOn ( azure , "updateHLDToManifestPipeline" ) . mockResolvedValueOnce ( {
154
+ PartitionKey : uuid ( ) ,
155
+ RowKey : uuid ( ) ,
156
+ commitId : uuid ( ) ,
157
+ env : uuid ( ) ,
158
+ hldCommitId : uuid ( ) ,
159
+ imageTag : uuid ( ) ,
160
+ p1 : uuid ( ) ,
161
+ p2 : uuid ( ) ,
162
+ p3 : uuid ( ) ,
163
+ service : uuid ( ) ,
164
+ } ) ;
171
165
const exitFn = jest . fn ( ) ;
172
166
173
167
const vals = getMockedValues ( true ) ;
@@ -181,7 +175,7 @@ describe("test execute function", () => {
181
175
it ( "[-ve]: with deployment table and p3 values; updateHLDToManifestPipeline fails" , async ( ) => {
182
176
jest
183
177
. spyOn ( azure , "updateHLDToManifestPipeline" )
184
- . mockReturnValueOnce ( Promise . reject ( ) ) ;
178
+ . mockRejectedValueOnce ( Error ( "fake error" ) ) ;
185
179
const exitFn = jest . fn ( ) ;
186
180
187
181
const vals = getMockedValues ( true ) ;
@@ -193,21 +187,19 @@ describe("test execute function", () => {
193
187
expect ( exitFn . mock . calls ) . toEqual ( [ [ 1 ] ] ) ;
194
188
} ) ;
195
189
it ( "[+ve]: with deployment table and p3 values and manifestCommitId values" , async ( ) => {
196
- jest . spyOn ( azure , "updateManifestCommitId" ) . mockReturnValueOnce (
197
- Promise . resolve ( {
198
- PartitionKey : uuid ( ) ,
199
- RowKey : uuid ( ) ,
200
- commitId : uuid ( ) ,
201
- env : uuid ( ) ,
202
- hldCommitId : uuid ( ) ,
203
- imageTag : uuid ( ) ,
204
- manifestCommitId : uuid ( ) ,
205
- p1 : uuid ( ) ,
206
- p2 : uuid ( ) ,
207
- p3 : uuid ( ) ,
208
- service : uuid ( ) ,
209
- } )
210
- ) ;
190
+ jest . spyOn ( azure , "updateManifestCommitId" ) . mockResolvedValueOnce ( {
191
+ PartitionKey : uuid ( ) ,
192
+ RowKey : uuid ( ) ,
193
+ commitId : uuid ( ) ,
194
+ env : uuid ( ) ,
195
+ hldCommitId : uuid ( ) ,
196
+ imageTag : uuid ( ) ,
197
+ manifestCommitId : uuid ( ) ,
198
+ p1 : uuid ( ) ,
199
+ p2 : uuid ( ) ,
200
+ p3 : uuid ( ) ,
201
+ service : uuid ( ) ,
202
+ } ) ;
211
203
const exitFn = jest . fn ( ) ;
212
204
213
205
const vals = getMockedValues ( true ) ;
@@ -221,7 +213,7 @@ describe("test execute function", () => {
221
213
it ( "[-ve]: with deployment table and p3 values; updateHLDToManifestPipeline fails" , async ( ) => {
222
214
jest
223
215
. spyOn ( azure , "updateManifestCommitId" )
224
- . mockReturnValueOnce ( Promise . reject ( ) ) ;
216
+ . mockRejectedValueOnce ( Error ( "fake error" ) ) ;
225
217
const exitFn = jest . fn ( ) ;
226
218
227
219
const vals = getMockedValues ( true ) ;
0 commit comments