next-test-api-route-handler • Docs
next-test-api-route-handler / NtarhInit
Internal
• NextResponseJsonType = unknown
optional
rejectOnHandlerError:boolean
If false
, errors thrown from within a handler are kicked up to Next.js's
resolver to deal with, which is what would happen in production. If true
,
the testApiHandler function will reject immediately instead.
You should use rejectOnHandlerError
whenever you want to manually handle
an error that bubbles up from your handler (which is especially true if
you're using expect
within your handler) or when you notice a false
negative despite exceptions being thrown.
false
test: (
parameters
) =>Promisable
<void
>
test
is a function that runs your test assertions. This function receives
one destructured parameter: fetch
, which is equivalent to
globalThis.fetch
but with the first parameter omitted.
• parameters
• parameters.fetch
Promisable
<void
>