Skip to content

Commit

Permalink
add test for middleswareAfterAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Oct 5, 2023
1 parent 21e5a5a commit 6c98402
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/nextlove/tests/route-spec-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<true>()
})

0 comments on commit 6c98402

Please sign in to comment.