Skip to content

Commit 2357a7d

Browse files
committed
docs(fundamentals): add mention on limitation of auto mocking
1 parent f966702 commit 2357a7d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

content/fundamentals/unit-testing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,11 @@ describe('CatsController', () => {
194194
});
195195
```
196196

197+
You can also retrieve these mocks out of the testing container as you normally would custom providers, `moduleRef.get(CatsService)`.
198+
197199
> info **Hint** A general mock factory, like `createMock` from [`@golevelup/ts-jest`](https://github.com/golevelup/nestjs/tree/master/packages/testing) can also be passed directly.
198200
199-
You can also retrieve these mocks out of the testing container as you normally would custom providers, `moduleRef.get(CatsService)`.
201+
> info **Hint** `REQUEST` and `INQUIRER` providers cannot be auto-mocked because they're already pre-defined in the context. However, they can be _overwritten_ using the custom provider syntax or by utilizing the `.overrideProvider` method.
200202
201203
#### End-to-end testing
202204

0 commit comments

Comments
 (0)