Skip to content

Commit 466aeb7

Browse files
committed
release: 4.0.8 [skip ci]
### [4.0.8](v4.0.7...v4.0.8) (2024-06-10) #### ⚙️ Build system * Revert conventional-changelog-cli update ([9967120](9967120)) * Update documentation generator ([43eec53](43eec53))
1 parent 9967120 commit 466aeb7

File tree

11 files changed

+801
-844
lines changed

11 files changed

+801
-844
lines changed

CHANGELOG.md

Lines changed: 527 additions & 517 deletions
Large diffs are not rendered by default.

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/README.md

Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,20 @@
1-
next-test-api-route-handler
1+
**next-test-api-route-handler****Docs**
22

3-
# next-test-api-route-handler
3+
***
44

5-
## Table of contents
5+
# next-test-api-route-handler
66

7-
### Interfaces
7+
## Interfaces
88

99
- [NtarhInit](interfaces/NtarhInit.md)
1010
- [NtarhInitAppRouter](interfaces/NtarhInitAppRouter.md)
1111
- [NtarhInitPagesRouter](interfaces/NtarhInitPagesRouter.md)
1212

13-
### Type Aliases
14-
15-
- [FetchReturnType](README.md#fetchreturntype)
16-
- [Promisable](README.md#promisable)
17-
18-
### Functions
19-
20-
- [testApiHandler](README.md#testapihandler)
21-
2213
## Type Aliases
2314

24-
### FetchReturnType
25-
26-
Ƭ **FetchReturnType**\<`NextResponseJsonType`\>: `Promise`\<`Omit`\<`Response`, ``"json"``\> & \{ `cookies`: `ReturnType`\<`parse`\>[] ; `json`: (...`args`: `Parameters`\<`Response`[``"json"``]\>) => `Promise`\<`NextResponseJsonType`\> }\>
27-
28-
#### Type parameters
29-
30-
| Name |
31-
| :------ |
32-
| `NextResponseJsonType` |
33-
34-
#### Defined in
35-
36-
[index.ts:100](https://github.com/Xunnamius/next-test-api-route-handler/blob/b7621d6b938246e73d656a1f9516def892b70ed0/src/index.ts#L100)
37-
38-
___
39-
40-
### Promisable
41-
42-
Ƭ **Promisable**\<`Promised`\>: `Promised` \| `Promise`\<`Promised`\>
43-
44-
#### Type parameters
45-
46-
| Name |
47-
| :------ |
48-
| `Promised` |
49-
50-
#### Defined in
51-
52-
[index.ts:95](https://github.com/Xunnamius/next-test-api-route-handler/blob/b7621d6b938246e73d656a1f9516def892b70ed0/src/index.ts#L95)
15+
- [FetchReturnType](type-aliases/FetchReturnType.md)
16+
- [Promisable](type-aliases/Promisable.md)
5317

5418
## Functions
5519

56-
### testApiHandler
57-
58-
**testApiHandler**\<`NextResponseJsonType`\>(`«destructured»`): `Promise`\<`void`\>
59-
60-
Uses Next's internal `apiResolver` (for Pages Router) or an
61-
`AppRouteRouteModule` instance (for App Router) to execute api route handlers
62-
in a Next-like testing environment.
63-
64-
#### Type parameters
65-
66-
| Name | Type |
67-
| :------ | :------ |
68-
| `NextResponseJsonType` | `any` |
69-
70-
#### Parameters
71-
72-
| Name | Type |
73-
| :------ | :------ |
74-
| `«destructured»` | [`NtarhInitAppRouter`](interfaces/NtarhInitAppRouter.md)\<`NextResponseJsonType`\> \| [`NtarhInitPagesRouter`](interfaces/NtarhInitPagesRouter.md)\<`NextResponseJsonType`\> |
75-
76-
#### Returns
77-
78-
`Promise`\<`void`\>
79-
80-
#### Defined in
81-
82-
[index.ts:273](https://github.com/Xunnamius/next-test-api-route-handler/blob/b7621d6b938246e73d656a1f9516def892b70ed0/src/index.ts#L273)
20+
- [testApiHandler](functions/testApiHandler.md)

docs/functions/testApiHandler.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[**next-test-api-route-handler**](../README.md)**Docs**
2+
3+
***
4+
5+
[next-test-api-route-handler](../README.md) / testApiHandler
6+
7+
# Function: testApiHandler()
8+
9+
> **testApiHandler**\<`NextResponseJsonType`\>(`__namedParameters`): `Promise`\<`void`\>
10+
11+
Uses Next's internal `apiResolver` (for Pages Router) or an
12+
`AppRouteRouteModule` instance (for App Router) to execute api route handlers
13+
in a Next-like testing environment.
14+
15+
## Type parameters
16+
17+
**NextResponseJsonType** = `any`
18+
19+
## Parameters
20+
21+
**\_\_namedParameters**: [`NtarhInitAppRouter`](../interfaces/NtarhInitAppRouter.md)\<`NextResponseJsonType`\> \| [`NtarhInitPagesRouter`](../interfaces/NtarhInitPagesRouter.md)\<`NextResponseJsonType`\>
22+
23+
## Returns
24+
25+
`Promise`\<`void`\>
26+
27+
## Source
28+
29+
[index.ts:273](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L273)

docs/interfaces/NtarhInit.md

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,65 @@
1-
[next-test-api-route-handler](../README.md) / NtarhInit
2-
3-
# Interface: NtarhInit\<NextResponseJsonType\>
4-
5-
## Type parameters
1+
[**next-test-api-route-handler**](../README.md)**Docs**
62

7-
| Name | Type |
8-
| :------ | :------ |
9-
| `NextResponseJsonType` | `unknown` |
3+
***
104

11-
## Hierarchy
12-
13-
- **`NtarhInit`**
5+
[next-test-api-route-handler](../README.md) / NtarhInit
146

15-
[`NtarhInitAppRouter`](NtarhInitAppRouter.md)
7+
# Interface: NtarhInit\<NextResponseJsonType\>
168

17-
[`NtarhInitPagesRouter`](NtarhInitPagesRouter.md)
9+
## Extended by
1810

19-
## Table of contents
11+
- [`NtarhInitAppRouter`](NtarhInitAppRouter.md)
12+
- [`NtarhInitPagesRouter`](NtarhInitPagesRouter.md)
2013

21-
### Properties
14+
## Type parameters
2215

23-
- [rejectOnHandlerError](NtarhInit.md#rejectonhandlererror)
24-
- [test](NtarhInit.md#test)
16+
**NextResponseJsonType** = `unknown`
2517

2618
## Properties
2719

28-
### rejectOnHandlerError
20+
### rejectOnHandlerError?
2921

30-
`Optional` **rejectOnHandlerError**: `boolean`
22+
> `optional` **rejectOnHandlerError**: `boolean`
3123
3224
If `false`, errors thrown from within a handler are kicked up to Next.js's
3325
resolver to deal with, which is what would happen in production. If `true`,
34-
the [testApiHandler](../README.md#testapihandler) function will reject immediately instead.
26+
the [testApiHandler](../functions/testApiHandler.md) function will reject immediately instead.
3527

3628
You should use `rejectOnHandlerError` whenever you want to manually handle
3729
an error that bubbles up from your handler (which is especially true if
3830
you're using `expect` _within_ your handler) or when you notice a false
3931
negative despite exceptions being thrown.
4032

41-
**`Default`**
33+
#### Default
4234

4335
```ts
4436
false
4537
```
4638

47-
#### Defined in
39+
#### Source
4840

49-
[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/b7621d6b938246e73d656a1f9516def892b70ed0/src/index.ts#L123)
41+
[index.ts:123](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L123)
5042

51-
___
43+
***
5244

53-
### test
45+
### test()
5446

55-
**test**: (`parameters`: \{ `fetch`: (`customInit?`: `RequestInit`) => [`FetchReturnType`](../README.md#fetchreturntype)\<`NextResponseJsonType`\> }) => [`Promisable`](../README.md#promisable)\<`void`\>
47+
> **test**: (`parameters`) => [`Promisable`](../type-aliases/Promisable.md)\<`void`\>
5648
5749
`test` is a function that runs your test assertions. This function receives
5850
one destructured parameter: `fetch`, which is equivalent to
5951
`globalThis.fetch` but with the first parameter omitted.
6052

61-
#### Type declaration
62-
63-
▸ (`parameters`): [`Promisable`](../README.md#promisable)\<`void`\>
53+
#### Parameters
6454

65-
##### Parameters
55+
**parameters**
6656

67-
| Name | Type |
68-
| :------ | :------ |
69-
| `parameters` | `Object` |
70-
| `parameters.fetch` | (`customInit?`: `RequestInit`) => [`FetchReturnType`](../README.md#fetchreturntype)\<`NextResponseJsonType`\> |
57+
**parameters.fetch**
7158

72-
##### Returns
59+
#### Returns
7360

74-
[`Promisable`](../README.md#promisable)\<`void`\>
61+
[`Promisable`](../type-aliases/Promisable.md)\<`void`\>
7562

76-
#### Defined in
63+
#### Source
7764

78-
[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/b7621d6b938246e73d656a1f9516def892b70ed0/src/index.ts#L129)
65+
[index.ts:129](https://github.com/Xunnamius/next-test-api-route-handler/blob/43eec5385cb48f619257324a2fe1b54d29748ff1/src/index.ts#L129)

0 commit comments

Comments
 (0)