@@ -10,6 +10,12 @@ import { makeMockJob, withPgClient } from "./helpers";
10
10
11
11
const options : WorkerSharedOptions = { } ;
12
12
13
+ const neverAbortController = new AbortController ( ) ;
14
+ const abortSignal = neverAbortController . signal ;
15
+ const abortPromise = new Promise < void > ( ( _ , reject ) => {
16
+ abortSignal . addEventListener ( "abort" , reject ) ;
17
+ } ) ;
18
+
13
19
describe ( "commonjs" , ( ) => {
14
20
test ( "gets tasks from folder" , ( ) =>
15
21
withPgClient ( async ( client ) => {
@@ -32,8 +38,8 @@ Array [
32
38
withPgClient : makeEnhancedWithPgClient (
33
39
makeWithPgClientFromClient ( client ) ,
34
40
) ,
35
- abortSignal : undefined ,
36
- abortPromise : undefined ,
41
+ abortSignal,
42
+ abortPromise,
37
43
} ,
38
44
) ;
39
45
expect ( await tasks . wouldyoulike ! ( helpers . job . payload , helpers ) ) . toEqual (
@@ -69,8 +75,8 @@ Array [
69
75
withPgClient : makeEnhancedWithPgClient (
70
76
makeWithPgClientFromClient ( client ) ,
71
77
) ,
72
- abortSignal : undefined ,
73
- abortPromise : undefined ,
78
+ abortSignal,
79
+ abortPromise,
74
80
} ,
75
81
) ;
76
82
expect ( await tasks . task1 ! ( helpers . job . payload , helpers ) ) . toEqual ( "hi" ) ;
@@ -100,8 +106,8 @@ Array [
100
106
withPgClient : makeEnhancedWithPgClient (
101
107
makeWithPgClientFromClient ( client ) ,
102
108
) ,
103
- abortSignal : undefined ,
104
- abortPromise : undefined ,
109
+ abortSignal,
110
+ abortPromise,
105
111
} ,
106
112
) ;
107
113
expect ( await tasks . task1 ! ( helpers . job . payload , helpers ) ) . toEqual ( "hi" ) ;
@@ -130,8 +136,8 @@ Array [
130
136
withPgClient : makeEnhancedWithPgClient (
131
137
makeWithPgClientFromClient ( client ) ,
132
138
) ,
133
- abortSignal : undefined ,
134
- abortPromise : undefined ,
139
+ abortSignal,
140
+ abortPromise,
135
141
} ) ;
136
142
expect ( await tasks . t1 ! ( helpers . job . payload , helpers ) ) . toEqual (
137
143
"come with me" ,
@@ -161,8 +167,8 @@ Array [
161
167
withPgClient : makeEnhancedWithPgClient (
162
168
makeWithPgClientFromClient ( client ) ,
163
169
) ,
164
- abortSignal : undefined ,
165
- abortPromise : undefined ,
170
+ abortSignal,
171
+ abortPromise,
166
172
} ) ;
167
173
expect ( await tasks . t1 ! ( helpers . job . payload , helpers ) ) . toEqual (
168
174
"come with me, TS" ,
@@ -196,8 +202,8 @@ Array [
196
202
withPgClient : makeEnhancedWithPgClient (
197
203
makeWithPgClientFromClient ( client ) ,
198
204
) ,
199
- abortSignal : undefined ,
200
- abortPromise : undefined ,
205
+ abortSignal,
206
+ abortPromise,
201
207
} ,
202
208
) ;
203
209
expect ( await tasks . wouldyoulike ! ( helpers . job . payload , helpers ) ) . toEqual (
@@ -230,8 +236,8 @@ Array [
230
236
withPgClient : makeEnhancedWithPgClient (
231
237
makeWithPgClientFromClient ( client ) ,
232
238
) ,
233
- abortSignal : undefined ,
234
- abortPromise : undefined ,
239
+ abortSignal,
240
+ abortPromise,
235
241
} ,
236
242
) ;
237
243
expect ( await tasks . task1 ! ( helpers . job . payload , helpers ) ) . toEqual ( "hi" ) ;
@@ -258,8 +264,8 @@ Array [
258
264
withPgClient : makeEnhancedWithPgClient (
259
265
makeWithPgClientFromClient ( client ) ,
260
266
) ,
261
- abortSignal : undefined ,
262
- abortPromise : undefined ,
267
+ abortSignal,
268
+ abortPromise,
263
269
} ) ;
264
270
expect ( await tasks . t1 ! ( helpers . job . payload , helpers ) ) . toEqual (
265
271
"come with me" ,
0 commit comments