Our great sponsors
-
Example https://github.com/leosuncin/nest-api-example/blob/master/src/auth/interceptors/token.interceptor.spec.ts
-
jest-mock-extended
Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended
You can use something like jest-mock-extended or @golevelup/ts-jest to mock it, and whether your interceptor has dependencies or not, can be more complex or simpler how you instance it.
-
Appwrite
Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!
-
testing-nestjs
A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!
Example https://github.com/jmcdo29/testing-nestjs/blob/8519ae7043d1dde5ae12a5d8f8ab02ea3c3c2fcf/apps/complex-sample/src/cat/cat.interceptor.spec.ts
-
It depends of how you mock the request and response that you passed to ExecutionContext because the response should be modified. I recommend you to use node-mocks-http