Skip to content

Commit 48feeab

Browse files
committed
test(app-express): stop test harness at end of every test
1 parent 76f4d42 commit 48feeab

File tree

9 files changed

+210
-120
lines changed

9 files changed

+210
-120
lines changed

packages/app-express/api/cache.test.ts

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Deno.test('cache', async (t) => {
7373
return res.body?.cancel()
7474
})
7575
)
76-
.finally(async () => await harness.stop())
76+
.then(() => harness.stop())
77+
.catch(() => harness.stop())
7778
})
7879

7980
await t.step('should pass name route param to core', async () => {
@@ -86,7 +87,8 @@ Deno.test('cache', async (t) => {
8687
assertEquals(body.name, 'movies')
8788
})
8889
)
89-
.finally(async () => await harness.stop())
90+
.then(() => harness.stop())
91+
.catch(() => harness.stop())
9092
})
9193
})
9294

@@ -103,7 +105,8 @@ Deno.test('cache', async (t) => {
103105
return res.body?.cancel()
104106
})
105107
)
106-
.finally(async () => await harness.stop())
108+
.then(() => harness.stop())
109+
.catch(() => harness.stop())
107110
})
108111

109112
await t.step('should pass name route param to core', async () => {
@@ -116,7 +119,8 @@ Deno.test('cache', async (t) => {
116119
assertEquals(body.name, 'movies')
117120
})
118121
)
119-
.finally(async () => await harness.stop())
122+
.then(() => harness.stop())
123+
.catch(() => harness.stop())
120124
})
121125
})
122126

@@ -148,7 +152,8 @@ Deno.test('cache', async (t) => {
148152
},
149153
)
150154
)
151-
.finally(async () => await harness.stop())
155+
.then(() => harness.stop())
156+
.catch(() => harness.stop())
152157
})
153158

154159
await t.step(
@@ -174,7 +179,8 @@ Deno.test('cache', async (t) => {
174179
assertEquals(body.pattern, 'foo*')
175180
})
176181
)
177-
.finally(async () => await harness.stop())
182+
.then(() => harness.stop())
183+
.catch(() => harness.stop())
178184
},
179185
)
180186
})
@@ -199,7 +205,8 @@ Deno.test('cache', async (t) => {
199205
return res.body?.cancel()
200206
})
201207
)
202-
.finally(async () => await harness.stop())
208+
.then(() => harness.stop())
209+
.catch(() => harness.stop())
203210
})
204211

205212
await t.step('should pass name route param and body to core', async () => {
@@ -222,7 +229,8 @@ Deno.test('cache', async (t) => {
222229
assertEquals(body.ttl, '1m')
223230
})
224231
)
225-
.finally(async () => await harness.stop())
232+
.then(() => harness.stop())
233+
.catch(() => harness.stop())
226234
})
227235
})
228236

@@ -239,7 +247,8 @@ Deno.test('cache', async (t) => {
239247
return res.body?.cancel()
240248
})
241249
)
242-
.finally(async () => await harness.stop())
250+
.then(() => harness.stop())
251+
.catch(() => harness.stop())
243252
})
244253

245254
await t.step('should pass name and key route params to core', async () => {
@@ -253,7 +262,8 @@ Deno.test('cache', async (t) => {
253262
assertEquals(body.doc.name, 'movies')
254263
})
255264
)
256-
.finally(async () => await harness.stop())
265+
.then(() => harness.stop())
266+
.catch(() => harness.stop())
257267
})
258268

259269
await t.step('should pass isLegacyGetEnabled to core', async () => {
@@ -270,7 +280,8 @@ Deno.test('cache', async (t) => {
270280
assertEquals(withLegacy.doc.isLegacyGetEnabled, true)
271281
})
272282
)
273-
.finally(async () => await harness.stop())
283+
.then(() => harness.stop())
284+
.catch(() => harness.stop())
274285
})
275286
})
276287

@@ -290,7 +301,8 @@ Deno.test('cache', async (t) => {
290301
return res.body?.cancel()
291302
})
292303
)
293-
.finally(async () => await harness.stop())
304+
.then(() => harness.stop())
305+
.catch(() => harness.stop())
294306
})
295307

296308
await t.step(
@@ -311,7 +323,8 @@ Deno.test('cache', async (t) => {
311323
assertEquals(body.ttl, '1m')
312324
})
313325
)
314-
.finally(async () => await harness.stop())
326+
.then(() => harness.stop())
327+
.catch(() => harness.stop())
315328
},
316329
)
317330
})
@@ -329,7 +342,8 @@ Deno.test('cache', async (t) => {
329342
return res.body?.cancel()
330343
})
331344
)
332-
.finally(async () => await harness.stop())
345+
.then(() => harness.stop())
346+
.catch(() => harness.stop())
333347
})
334348

335349
await t.step('should pass name and key route params to core', async () => {
@@ -343,7 +357,8 @@ Deno.test('cache', async (t) => {
343357
assertEquals(body.key, 'key')
344358
})
345359
)
346-
.finally(async () => await harness.stop())
360+
.then(() => harness.stop())
361+
.catch(() => harness.stop())
347362
})
348363
})
349364
})

packages/app-express/api/crawler.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ Deno.test('crawler', async (t) => {
5252
return res.body?.cancel()
5353
})
5454
)
55-
.finally(async () => await harness.stop())
55+
.then(() => harness.stop())
56+
.catch(() => harness.stop())
5657
})
5758

5859
await t.step(
@@ -88,7 +89,8 @@ Deno.test('crawler', async (t) => {
8889
assertObjectMatch(body.def, crawlerDefinition)
8990
})
9091
)
91-
.finally(async () => await harness.stop())
92+
.then(() => harness.stop())
93+
.catch(() => harness.stop())
9294
},
9395
)
9496
})
@@ -106,7 +108,8 @@ Deno.test('crawler', async (t) => {
106108
return res.body?.cancel()
107109
})
108110
)
109-
.finally(async () => await harness.stop())
111+
.then(() => harness.stop())
112+
.catch(() => harness.stop())
110113
})
111114

112115
await t.step(
@@ -120,7 +123,8 @@ Deno.test('crawler', async (t) => {
120123
assertEquals(body.bucket, 'test')
121124
assertEquals(body.name, 'spider')
122125
})
123-
.finally(async () => await harness.stop())
126+
.then(() => harness.stop())
127+
.catch(() => harness.stop())
124128
},
125129
)
126130
})
@@ -140,7 +144,8 @@ Deno.test('crawler', async (t) => {
140144
},
141145
)
142146
)
143-
.finally(async () => await harness.stop())
147+
.then(() => harness.stop())
148+
.catch(() => harness.stop())
144149
})
145150

146151
await t.step(
@@ -154,7 +159,8 @@ Deno.test('crawler', async (t) => {
154159
assertEquals(body.bucket, 'test')
155160
assertEquals(body.name, 'spider')
156161
})
157-
.finally(async () => await harness.stop())
162+
.then(() => harness.stop())
163+
.catch(() => harness.stop())
158164
},
159165
)
160166
})
@@ -172,7 +178,8 @@ Deno.test('crawler', async (t) => {
172178
return res.body?.cancel()
173179
})
174180
)
175-
.finally(async () => await harness.stop())
181+
.then(() => harness.stop())
182+
.catch(() => harness.stop())
176183
})
177184

178185
await t.step(
@@ -186,7 +193,8 @@ Deno.test('crawler', async (t) => {
186193
assertEquals(body.bucket, 'test')
187194
assertEquals(body.name, 'spider')
188195
})
189-
.finally(async () => await harness.stop())
196+
.then(() => harness.stop())
197+
.catch(() => harness.stop())
190198
},
191199
)
192200
})

0 commit comments

Comments
 (0)