Skip to content

Commit

Permalink
test(app-express): stop test harness at end of every test
Browse files Browse the repository at this point in the history
  • Loading branch information
TillaTheHun0 committed Apr 2, 2024
1 parent 76f4d42 commit 48feeab
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 120 deletions.
45 changes: 30 additions & 15 deletions packages/app-express/api/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Deno.test('cache', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step('should pass name route param to core', async () => {
Expand All @@ -86,7 +87,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.name, 'movies')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})
})

Expand All @@ -103,7 +105,8 @@ Deno.test('cache', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step('should pass name route param to core', async () => {
Expand All @@ -116,7 +119,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.name, 'movies')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})
})

Expand Down Expand Up @@ -148,7 +152,8 @@ Deno.test('cache', async (t) => {
},
)
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step(
Expand All @@ -174,7 +179,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.pattern, 'foo*')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
},
)
})
Expand All @@ -199,7 +205,8 @@ Deno.test('cache', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step('should pass name route param and body to core', async () => {
Expand All @@ -222,7 +229,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.ttl, '1m')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})
})

Expand All @@ -239,7 +247,8 @@ Deno.test('cache', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step('should pass name and key route params to core', async () => {
Expand All @@ -253,7 +262,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.doc.name, 'movies')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step('should pass isLegacyGetEnabled to core', async () => {
Expand All @@ -270,7 +280,8 @@ Deno.test('cache', async (t) => {
assertEquals(withLegacy.doc.isLegacyGetEnabled, true)
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})
})

Expand All @@ -290,7 +301,8 @@ Deno.test('cache', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step(
Expand All @@ -311,7 +323,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.ttl, '1m')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
},
)
})
Expand All @@ -329,7 +342,8 @@ Deno.test('cache', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step('should pass name and key route params to core', async () => {
Expand All @@ -343,7 +357,8 @@ Deno.test('cache', async (t) => {
assertEquals(body.key, 'key')
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})
})
})
24 changes: 16 additions & 8 deletions packages/app-express/api/crawler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Deno.test('crawler', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step(
Expand Down Expand Up @@ -88,7 +89,8 @@ Deno.test('crawler', async (t) => {
assertObjectMatch(body.def, crawlerDefinition)
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
},
)
})
Expand All @@ -106,7 +108,8 @@ Deno.test('crawler', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step(
Expand All @@ -120,7 +123,8 @@ Deno.test('crawler', async (t) => {
assertEquals(body.bucket, 'test')
assertEquals(body.name, 'spider')
})
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
},
)
})
Expand All @@ -140,7 +144,8 @@ Deno.test('crawler', async (t) => {
},
)
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step(
Expand All @@ -154,7 +159,8 @@ Deno.test('crawler', async (t) => {
assertEquals(body.bucket, 'test')
assertEquals(body.name, 'spider')
})
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
},
)
})
Expand All @@ -172,7 +178,8 @@ Deno.test('crawler', async (t) => {
return res.body?.cancel()
})
)
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
})

await t.step(
Expand All @@ -186,7 +193,8 @@ Deno.test('crawler', async (t) => {
assertEquals(body.bucket, 'test')
assertEquals(body.name, 'spider')
})
.finally(async () => await harness.stop())
.then(() => harness.stop())
.catch(() => harness.stop())
},
)
})
Expand Down
Loading

0 comments on commit 48feeab

Please sign in to comment.