Test interceptor

This page summarizes the projects mentioned and recommended in the original post on /r/Nestjs_framework

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • nest-api-example

    Example of an Restful API with Nest.js and TypeORM

  • 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.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • 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

  • node-mocks-http

    Mock 'http' objects for testing Express routing functions

  • 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

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts