Skip to content

Commit

Permalink
Add test for missing handler
Browse files Browse the repository at this point in the history
  • Loading branch information
istarkov committed Jul 6, 2024
1 parent d7a2046 commit 1ec0e9d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/AutoRouter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ describe(`SPECIFIC TESTS: AutoRouter`, () => {
expect(response.status).toBe(418)
})

it('missing: RouteHandler - receives request as the first parameter', async () => {
const missing = vi.fn(() => {})
const router = AutoRouter({ missing })
const request = toReq('/')
await router.fetch(request)
expect(missing).toBeCalledWith(request)
})

it('before: RouteHandler - adds upstream middleware', async () => {
const handler = vi.fn(r => typeof r.date)
const router = AutoRouter({
Expand Down

0 comments on commit 1ec0e9d

Please sign in to comment.