From 4d7049a30acefa34c1d3aa8a9990bfcfa16564b2 Mon Sep 17 00:00:00 2001 From: Yi-Ting Shih Date: Thu, 10 Jul 2025 18:20:04 +0800 Subject: [PATCH] Fix: e2e test --- src/app.controller.spec.ts | 3 ++- test/app.e2e-spec.ts | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts index c729cd5..e3f0d1c 100644 --- a/src/app.controller.spec.ts +++ b/src/app.controller.spec.ts @@ -1,4 +1,5 @@ import { Test, TestingModule } from '@nestjs/testing'; +import { ConfigService } from '@nestjs/config'; import { AppController } from './app.controller'; import { AppService } from './app.service'; @@ -8,7 +9,7 @@ describe('AppController', () => { beforeEach(async () => { const app: TestingModule = await Test.createTestingModule({ controllers: [AppController], - providers: [AppService], + providers: [ConfigService, AppService], }).compile(); appController = app.get(AppController); diff --git a/test/app.e2e-spec.ts b/test/app.e2e-spec.ts index 4df6580..752ffd1 100644 --- a/test/app.e2e-spec.ts +++ b/test/app.e2e-spec.ts @@ -1,5 +1,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { INestApplication } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; import * as request from 'supertest'; import { App } from 'supertest/types'; import { AppModule } from './../src/app.module'; @@ -16,10 +17,10 @@ describe('AppController (e2e)', () => { await app.init(); }); - it('/ (GET)', () => { + it('/healthz (GET)', () => { return request(app.getHttpServer()) - .get('/') + .get('/healthz') .expect(200) - .expect('Hello World!'); + .expect('OK'); }); });