docs(nest): add testing section to NestJS integration page - #2179
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
ℹ️ No critical issues — one minor documentation gap.
Reviewed changes
- NestJS testing section: Adds a
## Testingsection toapps/content/docs/integrations/nest.mdxdocumenting unit-testing a controller by resolving it fromTest.createTestingModule(...)and running the returned procedure withcall, passing an augmented initial context, and testing guards/pipes/interceptors end to end viacreateNestApplication().
ℹ️ 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)onplanet()), the decorated method returns a router object, and@Implementsynthesizes one method per procedure (planet_list,planet_find, …). Sincecalldoes not accept a router, a one-line note that router-contract tests call those synthesized methods would stop readers from tryingcall(controller.planet(), input).
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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:
Test.createTestingModule(...)and running the returned procedure withcall(controller.method(), input). Because@Implementonly adds routing metadata, no mocking ofimplement/@Implementis needed and contract input/output validation still runs.contexttocallwhenDefaultInitialContextis augmented.createNestApplication().I ran the example against
@orpc/nest2.0.0-beta.33: valid input resolves, invalid input rejects withBAD_REQUEST, bad output rejects withINTERNAL_SERVER_ERROR("Output validation failed"), and a plainErrorfrom the handler passes through unchanged.