Skip to content

Commit

Permalink
Fix: exposing testMiddleware (#2102)
Browse files Browse the repository at this point in the history
Fixes #2101
  • Loading branch information
RobinTail authored Oct 15, 2024
1 parent 388cc94 commit 762dd4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Version 20

### v20.14.3

- Fixed: missing export of `testMiddleware`:
- The feature introduced in v20.4.0 but was not available;
- The issue reported by [@Tomtec331](https://github.com/Tomtec331).

### v20.14.2

- Documentation: promoting Express 5 as the recommended version for new projects;
Expand Down Expand Up @@ -197,7 +203,8 @@ declare module "express-zod-api" {
- Feat: middleware testing helper: `testMiddleware()`, similar to `testEndpoint()`:
- There is also an ability to pass `options` collected from outputs of previous middlewares, if the one being tested
somehow depends on them.
- The method returns: `Promise<{ output, requestMock, responseMock, loggerMock }>`.
- The method returns: `Promise<{ output, requestMock, responseMock, loggerMock }>`;
- Export fixed in v20.14.3.

```typescript
import { z } from "zod";
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Therefore, many basic tasks can be accomplished faster and easier, in particular

These people contributed to the improvement of the library by reporting bugs, making changes and suggesting ideas:

[<img src="https://github.com/Tomtec331.png" alt="@Tomtec331" width="50px" />](https://github.com/Tomtec331)
[<img src="https://github.com/rottmann.png" alt="@rottmann" width="50px" />](https://github.com/rottmann)
[<img src="https://github.com/boarush.png" alt="@boarush" width="50px" />](https://github.com/boarush)
[<img src="https://github.com/daniel-white.png" alt="@daniel-white" width="50px" />](https://github.com/daniel-white)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export {
InputValidationError,
MissingPeerError,
} from "./errors";
export { testEndpoint } from "./testing";
export { testEndpoint, testMiddleware } from "./testing";
export { Integration } from "./integration";

export { ez } from "./proprietary-schemas";
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ exports[`Index Entrypoint > exports > should have certain entities exposed 1`] =
"InputValidationError",
"MissingPeerError",
"testEndpoint",
"testMiddleware",
"Integration",
"ez",
]
`;

exports[`Index Entrypoint > exports > testEndpoint should have certain value 1`] = `[Function]`;

exports[`Index Entrypoint > exports > testMiddleware should have certain value 1`] = `[Function]`;

0 comments on commit 762dd4e

Please sign in to comment.