From 432f6a88e4c676d81e0586fdc634c7972140d1ff Mon Sep 17 00:00:00 2001 From: Chooooooo Date: Sun, 11 Feb 2024 22:50:57 +0900 Subject: [PATCH] =?UTF-8?q?Test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 업로드 모듈에서 테스트 모듈 의존성 추가 - 토익 문제 모듈에서 테스트 모듈 의존성 추가 Related to #18 --- backend/src/toeic/toeic.controller.spec.ts | 5 +---- backend/src/toeic/toeic.controller.ts | 2 +- backend/src/toeic/toeic.service.spec.ts | 12 ++++++------ backend/src/upload/upload.controller.spec.ts | 8 +++++++- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/backend/src/toeic/toeic.controller.spec.ts b/backend/src/toeic/toeic.controller.spec.ts index 816f3e0..cea9f46 100644 --- a/backend/src/toeic/toeic.controller.spec.ts +++ b/backend/src/toeic/toeic.controller.spec.ts @@ -11,10 +11,7 @@ describe('ToeicController', () => { beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ controllers: [ToeicController], - providers: [ - ToeicService, - { provide: ToeicService, useClass: MockToeicService }, - ], + providers: [{ provide: ToeicService, useClass: MockToeicService }], }).compile(); toeicService = module.get(ToeicService); diff --git a/backend/src/toeic/toeic.controller.ts b/backend/src/toeic/toeic.controller.ts index 1d99c29..cf7e21c 100644 --- a/backend/src/toeic/toeic.controller.ts +++ b/backend/src/toeic/toeic.controller.ts @@ -1,6 +1,6 @@ import { Controller, Get, Param } from '@nestjs/common'; import { ToeicService } from './toeic.service'; -import { ApiSwagger } from 'src/common/swagger/api.decorator'; +import { ApiSwagger } from '../common/swagger/api.decorator'; @Controller('toeic') export class ToeicController { diff --git a/backend/src/toeic/toeic.service.spec.ts b/backend/src/toeic/toeic.service.spec.ts index 07eb7fc..7291f70 100644 --- a/backend/src/toeic/toeic.service.spec.ts +++ b/backend/src/toeic/toeic.service.spec.ts @@ -1,27 +1,27 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ToeicService } from './toeic.service'; -import { SupabaseService } from '../supabase/supabase.service'; +import { PrismaService } from '../prisma/prisma.service'; -class MockSupabaseService {} +class MockPrisma {} describe('ToeicService', () => { let service: ToeicService; - let supabaseService: SupabaseService; + let prisma: PrismaService; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ providers: [ ToeicService, - { provide: SupabaseService, useClass: MockSupabaseService }, + { provide: PrismaService, useClass: MockPrisma }, ], }).compile(); service = module.get(ToeicService); - supabaseService = module.get(SupabaseService); + prisma = module.get(PrismaService); }); it('should be defined', () => { expect(service).toBeDefined(); - expect(supabaseService).toBeDefined(); + expect(prisma).toBeDefined(); }); }); diff --git a/backend/src/upload/upload.controller.spec.ts b/backend/src/upload/upload.controller.spec.ts index 387a4a2..2a962b3 100644 --- a/backend/src/upload/upload.controller.spec.ts +++ b/backend/src/upload/upload.controller.spec.ts @@ -2,12 +2,15 @@ import { Test, TestingModule } from '@nestjs/testing'; import { UploadController } from './upload.controller'; import { UploadService } from './upload.service'; import { ToeicService } from '../toeic/toeic.service'; +import { AuthService } from '../auth/auth.service'; class MockToeicService {} +class MockAuthService {} -describe('PdfUploaderController', () => { +describe('UploaderController', () => { let controller: UploadController; let toeicService: ToeicService; + let authService: AuthService; beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ @@ -15,15 +18,18 @@ describe('PdfUploaderController', () => { providers: [ UploadService, { provide: ToeicService, useClass: MockToeicService }, + { provide: AuthService, useClass: MockAuthService }, ], }).compile(); toeicService = module.get(ToeicService); + authService = module.get(AuthService); controller = module.get(UploadController); }); it('should be defined', () => { expect(controller).toBeDefined(); + expect(authService).toBeDefined(); expect(toeicService).toBeDefined(); }); });