From 6c984021fda102206200ca5729ba4418f645b4c8 Mon Sep 17 00:00:00 2001 From: Severin Ibarluzea Date: Thu, 5 Oct 2023 16:35:22 -0700 Subject: [PATCH] add test for middleswareAfterAuth --- packages/nextlove/tests/route-spec-types.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/nextlove/tests/route-spec-types.ts b/packages/nextlove/tests/route-spec-types.ts index de1516e72..a20b117f1 100644 --- a/packages/nextlove/tests/route-spec-types.ts +++ b/packages/nextlove/tests/route-spec-types.ts @@ -227,3 +227,20 @@ export const myRoute9 = withRouteSpec(myRoute9Spec)(async (req, res) => { const errorApiResponse400 = res.status(400) expectTypeOf(errorApiResponse400.json).toMatchTypeOf<(body: any) => void>() }) + +export const myRoute10 = createWithRouteSpec({ + authMiddlewareMap: {}, + globalAfterAuthMiddlewares: [ + null as any as Middleware<{ + good: true + }>, + ], + apiName: "", + globalMiddlewares: [], + productionServerUrl: "", +} as const)({ + auth: "none", + methods: ["GET"], +} as const)(async (req, res) => { + expectTypeOf(req.good).toMatchTypeOf() +})