Skip to content

docs(nest): add testing section to NestJS integration page - #2179

Merged
dinwwwh merged 1 commit into
middleapi:mainfrom
Mnigos:docs/nest-testing
Oct 5, 2026
Merged

dinwwwh merged 1 commit into
middleapi:mainfrom
Mnigos:docs/nest-testing

Conversation

@Mnigos

@Mnigos Mnigos commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Adds a short "Testing" section to the NestJS integration page.

The page had no testing guidance, and the generic Testing and Mocking page does not mention NestJS. The section covers:

  • Unit-testing a controller by resolving it from Test.createTestingModule(...) and running the returned procedure with call(controller.method(), input). Because @Implement only adds routing metadata, no mocking of implement/@Implement is needed and contract input/output validation still runs.
  • Passing context to call when DefaultInitialContext is augmented.
  • Testing guards, pipes, interceptors and param decorators end to end with createNestApplication().
  • A link to Testing and Mocking.

I ran the example against @orpc/nest 2.0.0-beta.33: valid input resolves, invalid input rejects with BAD_REQUEST, bad output rejects with INTERNAL_SERVER_ERROR ("Output validation failed"), and a plain Error from the handler passes through unchanged.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor documentation gap.

Reviewed changes

  • NestJS testing section: Adds a ## Testing section to apps/content/docs/integrations/nest.mdx documenting unit-testing a controller by resolving it from Test.createTestingModule(...) and running the returned procedure with call, passing an augmented initial context, and testing guards/pipes/interceptors end to end via createNestApplication().

ℹ️ Nitpicks

  • The opening claim that "a controller method is a plain method that returns an implemented procedure" only holds for procedure contracts. For the router-contract pattern this page teaches first (@Implement(contract.planet) on planet()), the decorated method returns a router object, and @Implement synthesizes one method per procedure (planet_list, planet_find, …). Since call does not accept a router, a one-line note that router-contract tests call those synthesized methods would stop readers from trying call(controller.planet(), input).

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@codspeed

codspeed Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 30 untouched benchmarks


Comparing Mnigos:docs/nest-testing (e30589a) with main (2dc6099)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (95dcbbf) during the generation of this report, so 2dc6099 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@dinwwwh
dinwwwh merged commit d3ec224 into middleapi:main Oct 5, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants