Skip to content

Commit

Permalink
Test: 테스트 모듈 추가
Browse files Browse the repository at this point in the history
- 모듈 추가에 따른 테스트 모듈 추가

Related to #18
  • Loading branch information
Zamoca42 committed Feb 7, 2024
1 parent 484d1b0 commit bb4d8bb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,8 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/macos,windows,node
# End of https://www.toptal.com/developers/gitignore/api/macos,windows,node

# Backend Ignore

backend/static
10 changes: 9 additions & 1 deletion backend/src/toeic/toeic.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ import { Test, TestingModule } from '@nestjs/testing';
import { ToeicController } from './toeic.controller';
import { ToeicService } from './toeic.service';

class MockToeicService {}

describe('ToeicController', () => {
let controller: ToeicController;
let toeicService: ToeicService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [ToeicController],
providers: [ToeicService],
providers: [
ToeicService,
{ provide: ToeicService, useClass: MockToeicService },
],
}).compile();

toeicService = module.get<ToeicService>(ToeicService);
controller = module.get<ToeicController>(ToeicController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
expect(toeicService).toBeDefined();
});
});
11 changes: 10 additions & 1 deletion backend/src/toeic/toeic.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ToeicService } from './toeic.service';
import { SupabaseService } from '../supabase/supabase.service';

class MockSupabaseService {}

describe('ToeicService', () => {
let service: ToeicService;
let supabaseService: SupabaseService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [ToeicService],
providers: [
ToeicService,
{ provide: SupabaseService, useClass: MockSupabaseService },
],
}).compile();

service = module.get<ToeicService>(ToeicService);
supabaseService = module.get<SupabaseService>(SupabaseService);
});

it('should be defined', () => {
expect(service).toBeDefined();
expect(supabaseService).toBeDefined();
});
});
11 changes: 10 additions & 1 deletion backend/src/upload/upload.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { Test, TestingModule } from '@nestjs/testing';
import { UploadController } from './upload.controller';
import { UploadService } from './upload.service';
import { ToeicService } from '../toeic/toeic.service';

class MockToeicService {}

describe('PdfUploaderController', () => {
let controller: UploadController;
let toeicService: ToeicService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [UploadController],
providers: [UploadService],
providers: [
UploadService,
{ provide: ToeicService, useClass: MockToeicService },
],
}).compile();

toeicService = module.get<ToeicService>(ToeicService);
controller = module.get<UploadController>(UploadController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
expect(toeicService).toBeDefined();
});
});

0 comments on commit bb4d8bb

Please sign in to comment.