Skip to content

Latest commit

 

History

History
67 lines (39 loc) · 1.7 KB

File metadata and controls

67 lines (39 loc) · 1.7 KB

next-test-api-route-handlerDocs


next-test-api-route-handler / NtarhInit

Interface: NtarhInit<NextResponseJsonType>

Internal

Extended by

Type Parameters

NextResponseJsonType = unknown

Properties

rejectOnHandlerError?

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.

Default

false

Defined in

index.ts:137


test()

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

parameters.fetch

Returns

Promisable<void>

Defined in

index.ts:143