@@ -133,10 +133,17 @@ describe("workflow client", () => {
133
133
url : "http://requestcatcher.com" ,
134
134
} ) ;
135
135
136
- const firstCancel = await liveClient . cancel ( {
137
- ids : [ workflowRunIdOne , workflowRunIdTwo , "non-existent" ] ,
138
- } ) ;
139
- expect ( firstCancel ) . toEqual ( { cancelled : 2 } ) ;
136
+ await new Promise ( ( r ) => setTimeout ( r , 2000 ) ) ;
137
+
138
+ eventually (
139
+ async ( ) => {
140
+ const firstCancel = await liveClient . cancel ( {
141
+ ids : [ workflowRunIdOne , workflowRunIdTwo , "non-existent" ] ,
142
+ } ) ;
143
+ expect ( firstCancel ) . toEqual ( { cancelled : 2 } ) ;
144
+ } ,
145
+ { timeout : 5000 , interval : 1000 }
146
+ ) ;
140
147
141
148
// trying to cancel the workflows one by one gives error, as they were canceled above
142
149
const secondCancel = await liveClient . cancel ( { ids : workflowRunIdOne } ) ;
@@ -147,7 +154,7 @@ describe("workflow client", () => {
147
154
expect ( thirdCancel ) . toEqual ( { cancelled : 0 } ) ;
148
155
} ,
149
156
{
150
- timeout : 10000 ,
157
+ timeout : 20000 ,
151
158
}
152
159
) ;
153
160
@@ -161,14 +168,20 @@ describe("workflow client", () => {
161
168
url : "http://requestcatcher.com/second" ,
162
169
} ) ;
163
170
164
- const cancel = await liveClient . cancel ( {
165
- urlStartingWith : "http://requestcatcher.com" ,
166
- } ) ;
171
+ await new Promise ( ( r ) => setTimeout ( r , 2000 ) ) ;
167
172
168
- expect ( cancel ) . toEqual ( { cancelled : 2 } ) ;
173
+ eventually (
174
+ async ( ) => {
175
+ const cancel = await liveClient . cancel ( {
176
+ urlStartingWith : "http://requestcatcher.com" ,
177
+ } ) ;
178
+ expect ( cancel ) . toEqual ( { cancelled : 2 } ) ;
179
+ } ,
180
+ { timeout : 5000 , interval : 1000 }
181
+ ) ;
169
182
} ,
170
183
{
171
- timeout : 10000 ,
184
+ timeout : 15000 ,
172
185
}
173
186
) ;
174
187
0 commit comments