From 48feeabbfe6fa6b39643bbc680f7ffc20594a8fd Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Tue, 2 Apr 2024 10:18:46 -0400 Subject: [PATCH] test(app-express): stop test harness at end of every test --- packages/app-express/api/cache.test.ts | 45 ++++++---- packages/app-express/api/crawler.test.ts | 24 +++-- packages/app-express/api/data.test.ts | 72 ++++++++++----- packages/app-express/api/queue.test.ts | 30 ++++--- packages/app-express/api/search.test.ts | 48 ++++++---- packages/app-express/api/storage.test.ts | 89 +++++++++++-------- packages/app-express/middleware/json.test.ts | 12 ++- .../app-express/middleware/legacyGet.test.ts | 9 +- packages/app-express/types.ts | 1 - 9 files changed, 210 insertions(+), 120 deletions(-) diff --git a/packages/app-express/api/cache.test.ts b/packages/app-express/api/cache.test.ts index f82a5bfb..b12b98f9 100644 --- a/packages/app-express/api/cache.test.ts +++ b/packages/app-express/api/cache.test.ts @@ -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 () => { @@ -86,7 +87,8 @@ Deno.test('cache', async (t) => { assertEquals(body.name, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -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 () => { @@ -116,7 +119,8 @@ Deno.test('cache', async (t) => { assertEquals(body.name, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -148,7 +152,8 @@ Deno.test('cache', async (t) => { }, ) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -174,7 +179,8 @@ Deno.test('cache', async (t) => { assertEquals(body.pattern, 'foo*') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -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 () => { @@ -222,7 +229,8 @@ Deno.test('cache', async (t) => { assertEquals(body.ttl, '1m') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -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 () => { @@ -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 () => { @@ -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()) }) }) @@ -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( @@ -311,7 +323,8 @@ Deno.test('cache', async (t) => { assertEquals(body.ttl, '1m') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -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 () => { @@ -343,7 +357,8 @@ Deno.test('cache', async (t) => { assertEquals(body.key, 'key') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) }) diff --git a/packages/app-express/api/crawler.test.ts b/packages/app-express/api/crawler.test.ts index 8810ac45..8db33e40 100644 --- a/packages/app-express/api/crawler.test.ts +++ b/packages/app-express/api/crawler.test.ts @@ -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( @@ -88,7 +89,8 @@ Deno.test('crawler', async (t) => { assertObjectMatch(body.def, crawlerDefinition) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -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( @@ -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()) }, ) }) @@ -140,7 +144,8 @@ Deno.test('crawler', async (t) => { }, ) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -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()) }, ) }) @@ -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( @@ -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()) }, ) }) diff --git a/packages/app-express/api/data.test.ts b/packages/app-express/api/data.test.ts index a7abd66e..aecfdfe0 100644 --- a/packages/app-express/api/data.test.ts +++ b/packages/app-express/api/data.test.ts @@ -52,7 +52,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass db route param to core', async () => { @@ -65,7 +66,8 @@ Deno.test('data', async (t) => { assertEquals(body.db, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -82,7 +84,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass db route param to core', async () => { @@ -95,7 +98,8 @@ Deno.test('data', async (t) => { assertEquals(body.db, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -112,7 +116,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -134,7 +139,8 @@ Deno.test('data', async (t) => { assertEquals(body.query, { limit: '2', foo: 'bar' }) }) ) - .finally(() => harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) @@ -152,7 +158,8 @@ Deno.test('data', async (t) => { assertEquals(body.query, {}) }) ) - .finally(() => harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) @@ -170,7 +177,8 @@ Deno.test('data', async (t) => { assertEquals(body.query, {}) }) ) - .finally(() => harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -194,7 +202,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass db route param and body to core', async () => { @@ -214,7 +223,8 @@ Deno.test('data', async (t) => { assertEquals(body.db, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -231,7 +241,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass db and id route params to core', async () => { @@ -245,7 +256,8 @@ Deno.test('data', async (t) => { assertEquals(body.doc.db, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass isLegacyGetEnabled to core', async () => { @@ -262,7 +274,8 @@ Deno.test('data', async (t) => { assertEquals(withLegacy.doc.isLegacyGetEnabled, true) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -285,7 +298,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -308,7 +322,8 @@ Deno.test('data', async (t) => { assertEquals(body.db, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -328,7 +343,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -346,7 +362,8 @@ Deno.test('data', async (t) => { assertEquals(body.db, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -370,7 +387,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -396,7 +414,8 @@ Deno.test('data', async (t) => { assertEquals(body.partialFilter, { type: 'bar' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -419,7 +438,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass db and body to core', async () => { @@ -438,7 +458,8 @@ Deno.test('data', async (t) => { assertEquals(body.query, { type: 'movie' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -457,7 +478,8 @@ Deno.test('data', async (t) => { assertEquals(body.query, {}) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -478,7 +500,8 @@ Deno.test('data', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -498,7 +521,8 @@ Deno.test('data', async (t) => { assertEquals(body.results, [{ id: '1', type: 'movie' }]) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) diff --git a/packages/app-express/api/queue.test.ts b/packages/app-express/api/queue.test.ts index 4b2fa3f8..083f4598 100644 --- a/packages/app-express/api/queue.test.ts +++ b/packages/app-express/api/queue.test.ts @@ -60,7 +60,8 @@ Deno.test('queue', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass name route params and body to core', async () => { @@ -83,7 +84,8 @@ Deno.test('queue', async (t) => { }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -102,7 +104,8 @@ Deno.test('queue', 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 () => { @@ -117,7 +120,8 @@ Deno.test('queue', async (t) => { assertEquals(body.arg, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -140,7 +144,8 @@ Deno.test('queue', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass name route params and body to core', async () => { @@ -165,7 +170,8 @@ Deno.test('queue', async (t) => { }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -182,7 +188,8 @@ Deno.test('queue', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -200,7 +207,8 @@ Deno.test('queue', async (t) => { }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -218,7 +226,8 @@ Deno.test('queue', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -236,7 +245,8 @@ Deno.test('queue', async (t) => { }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) diff --git a/packages/app-express/api/search.test.ts b/packages/app-express/api/search.test.ts index 2c6d08a7..25f21f99 100644 --- a/packages/app-express/api/search.test.ts +++ b/packages/app-express/api/search.test.ts @@ -84,7 +84,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -109,7 +110,8 @@ Deno.test('search', async (t) => { }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -129,7 +131,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass index route params to core', async () => { @@ -144,7 +147,8 @@ Deno.test('search', async (t) => { assertEquals(body.index, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -167,7 +171,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -190,7 +195,8 @@ Deno.test('search', async (t) => { assertEquals(body.doc, { foo: 'bar' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -208,7 +214,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass index and key route params to core', async () => { @@ -222,7 +229,8 @@ Deno.test('search', async (t) => { assertEquals(body.key, '1') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -242,7 +250,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -262,7 +271,8 @@ Deno.test('search', async (t) => { assertEquals(body.doc, { foo: 'bar' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -280,7 +290,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should pass index and key route params to core', async () => { @@ -294,7 +305,8 @@ Deno.test('search', async (t) => { assertEquals(body.key, '1') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -316,7 +328,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -337,7 +350,8 @@ Deno.test('search', async (t) => { assertEquals(body.query, { query: 'foobar' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -358,7 +372,8 @@ Deno.test('search', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -378,7 +393,8 @@ Deno.test('search', async (t) => { assertEquals(body.docs[1], { fizz: 'buzz' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) diff --git a/packages/app-express/api/storage.test.ts b/packages/app-express/api/storage.test.ts index a46fe114..d81f4555 100644 --- a/packages/app-express/api/storage.test.ts +++ b/packages/app-express/api/storage.test.ts @@ -82,7 +82,8 @@ Deno.test('storage', 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 () => { @@ -97,7 +98,8 @@ Deno.test('storage', async (t) => { assertEquals(body.name, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -116,7 +118,8 @@ Deno.test('storage', 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 () => { @@ -131,7 +134,8 @@ Deno.test('storage', async (t) => { assertEquals(body.name, 'movies') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -150,7 +154,8 @@ Deno.test('storage', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -168,7 +173,8 @@ Deno.test('storage', async (t) => { assertEquals(body.object, 'foo/bar.png') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) @@ -191,7 +197,8 @@ Deno.test('storage', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) @@ -211,7 +218,8 @@ Deno.test('storage', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) @@ -238,7 +246,8 @@ Deno.test('storage', async (t) => { assertEquals(body, 'Some awesome object content') }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) @@ -259,7 +268,8 @@ Deno.test('storage', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) @@ -276,39 +286,40 @@ Deno.test('storage', async (t) => { return res.body?.cancel() }) ) - .finally(async () => await harness.stop()), + .then(() => harness.stop()) + .catch(() => harness.stop()), ) }) }) + // await t.step('POST /storage/:name', async (t) => { + // await t.step({ + // name: 'should set the Content-Type header', + // fn: async () => { + // const formData = new FormData() + // formData.append( + // 'file', + // new Blob([JSON.stringify({ foo: 'bar' }, null, 2)], { + // type: 'application/json', + // }), + // 'foobar.json', + // ) - // await t.step('POST /storage/:name', async (t) => { - // await t.step({ - // name: 'should set the Content-Type header', - // fn: async () => { - // const formData = new FormData() - // formData.append( - // 'file', - // new Blob([JSON.stringify({ foo: 'bar' }, null, 2)], { - // type: 'application/json', - // }), - // 'foobar.json', - // ) - - // await harness - // .start() - // .then(() => - // harness('/storage/movies', { - // method: 'POST', - // body: formData, - // }).then((res) => { - // assertEquals( - // res.headers.get('content-type'), - // 'application/json; charset=utf-8', - // ) - // return res.body?.cancel() - // }) - // ) - // .finally(async () => await harness.stop()) + // await harness + // .start() + // .then(() => + // harness('/storage/movies', { + // method: 'POST', + // body: formData, + // }).then((res) => { + // assertEquals( + // res.headers.get('content-type'), + // 'application/json; charset=utf-8', + // ) + // return res.body?.cancel() + // }) + // ) + // .then(() => harness.stop()) + .catch(() => harness.stop()) // }, // sanitizeResources: false, // sanitizeOps: false, diff --git a/packages/app-express/middleware/json.test.ts b/packages/app-express/middleware/json.test.ts index 50822e6f..84cd0df9 100644 --- a/packages/app-express/middleware/json.test.ts +++ b/packages/app-express/middleware/json.test.ts @@ -26,7 +26,8 @@ Deno.test('json', async (t) => { assertObjectMatch(body, { id: '1', type: 'movie' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -44,7 +45,8 @@ Deno.test('json', async (t) => { assertObjectMatch(body, { id: '1', type: 'movie' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) @@ -69,7 +71,8 @@ Deno.test('json', async (t) => { assertObjectMatch(body, { id: '1', type: 'movie' }) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should parse as json', async () => { @@ -85,7 +88,8 @@ Deno.test('json', async (t) => { assertObjectMatch({}, body) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) }) }) diff --git a/packages/app-express/middleware/legacyGet.test.ts b/packages/app-express/middleware/legacyGet.test.ts index 82a877d9..a0185684 100644 --- a/packages/app-express/middleware/legacyGet.test.ts +++ b/packages/app-express/middleware/legacyGet.test.ts @@ -24,7 +24,8 @@ Deno.test('legacyGet', async (t) => { assert(body.isLegacyGetEnabled) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step('should set isLegacyGetEnabled to false', async () => { @@ -39,7 +40,8 @@ Deno.test('legacyGet', async (t) => { assert(!body.isLegacyGetEnabled) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }) await t.step( @@ -54,7 +56,8 @@ Deno.test('legacyGet', async (t) => { assert(body.isLegacyGetEnabled === undefined) }) ) - .finally(async () => await harness.stop()) + .then(() => harness.stop()) + .catch(() => harness.stop()) }, ) }) diff --git a/packages/app-express/types.ts b/packages/app-express/types.ts index 471ce484..95973e1f 100644 --- a/packages/app-express/types.ts +++ b/packages/app-express/types.ts @@ -25,7 +25,6 @@ export interface HyperServices { declare global { namespace Express { - // deno-lint-ignore no-empty-interface export interface Request extends HyperServices {} } }