From 8f05d8faaa3520052219b1dd87386246d68e5765 Mon Sep 17 00:00:00 2001 From: Chau Tran Date: Mon, 11 Jan 2021 11:09:55 -0600 Subject: [PATCH] refactor(nestjs): use global option for forRoot instead of Global decorator --- .../src/app/app.controller.spec.ts | 24 ------------------- packages/nestjs/src/lib/automapper.module.ts | 4 ++-- packages/nestjs/src/lib/interceptors/index.ts | 0 .../src/lib/interceptors/map.interceptor.ts | 0 .../src/lib/interceptors/memoize.util.ts | 0 5 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 packages/nestjs-integration-test/src/app/app.controller.spec.ts create mode 100644 packages/nestjs/src/lib/interceptors/index.ts create mode 100644 packages/nestjs/src/lib/interceptors/map.interceptor.ts create mode 100644 packages/nestjs/src/lib/interceptors/memoize.util.ts diff --git a/packages/nestjs-integration-test/src/app/app.controller.spec.ts b/packages/nestjs-integration-test/src/app/app.controller.spec.ts deleted file mode 100644 index e0a9b2fcf..000000000 --- a/packages/nestjs-integration-test/src/app/app.controller.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; - -import { AppController } from './app.controller'; -import { AppService } from './app.service'; - -describe('AppController', () => { - let app: TestingModule; - - beforeAll(async () => { - app = await Test.createTestingModule({ - controllers: [AppController], - providers: [AppService], - }).compile(); - }); - - describe('getData', () => { - it('should return "Welcome to nestjs-integration-test!"', () => { - const appController = app.get(AppController); - expect(appController.getData()).toEqual({ - message: 'Welcome to nestjs-integration-test!', - }); - }); - }); -}); diff --git a/packages/nestjs/src/lib/automapper.module.ts b/packages/nestjs/src/lib/automapper.module.ts index c86b50b10..49c64ce9d 100644 --- a/packages/nestjs/src/lib/automapper.module.ts +++ b/packages/nestjs/src/lib/automapper.module.ts @@ -1,8 +1,7 @@ -import { DynamicModule, Global, Logger, Module } from '@nestjs/common'; +import { DynamicModule, Logger, Module } from '@nestjs/common'; import { createAutomapperProviders } from './create-automapper-providers.util'; import type { AutomapperModuleOptions } from './interfaces'; -@Global() @Module({}) export class AutomapperModule { private static readonly logger = new Logger(AutomapperModule.name); @@ -16,6 +15,7 @@ export class AutomapperModule { return { module: AutomapperModule, + global: true, providers, exports: providers, }; diff --git a/packages/nestjs/src/lib/interceptors/index.ts b/packages/nestjs/src/lib/interceptors/index.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/nestjs/src/lib/interceptors/map.interceptor.ts b/packages/nestjs/src/lib/interceptors/map.interceptor.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/nestjs/src/lib/interceptors/memoize.util.ts b/packages/nestjs/src/lib/interceptors/memoize.util.ts new file mode 100644 index 000000000..e69de29bb