From e86028e0aa14e66a0acb56f1d9bf654a73ba31b8 Mon Sep 17 00:00:00 2001 From: erik1110 Date: Tue, 2 Jan 2024 17:50:40 +0800 Subject: [PATCH] [feat] add first test --- .github/workflows/main.yaml | 1 - src/app.controller.spec.ts | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/app.controller.spec.ts diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 69bf8d2..2eeaa55 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -30,7 +30,6 @@ jobs: run: | npm install npm run build --if-present - npm run test --if-present env: MONGO_URI: ${{ secrets.MONGO_URI }} ENCRYPT_JWT_SECRET: ${{ secrets.ENCRYPT_JWT_SECRET }} diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts new file mode 100644 index 0000000..e1ffae6 --- /dev/null +++ b/src/app.controller.spec.ts @@ -0,0 +1,21 @@ +// app.controller.spec.ts +import { Test, TestingModule } from '@nestjs/testing'; +import { AppController } from './app.controller'; + +describe('AppController', () => { + let appController: AppController; + + beforeEach(async () => { + const app: TestingModule = await Test.createTestingModule({ + controllers: [AppController], + }).compile(); + + appController = app.get(AppController); + }); + + describe('root', () => { + it('should return "Hello World!"', () => { + expect(appController.root()).toBe('Health Check'); + }); + }); +}); \ No newline at end of file