-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 북마크 테스트에서 모듈 불러오기 Related to #42
- Loading branch information
Showing
3 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { BookmarkController } from './bookmark.controller'; | ||
import { BookmarkService } from './bookmark.service'; | ||
import { AuthService } from '../auth/auth.service'; | ||
|
||
class MockBookmarkService {} | ||
class MockAuthService {} | ||
|
||
describe('BookmarkController', () => { | ||
let controller: BookmarkController; | ||
let bookmarkService: BookmarkService; | ||
let authService: AuthService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [BookmarkController], | ||
providers: [BookmarkService], | ||
providers: [ | ||
{ provide: BookmarkService, useClass: MockBookmarkService }, | ||
{ provide: AuthService, useClass: MockAuthService }, | ||
], | ||
}).compile(); | ||
|
||
bookmarkService = module.get<BookmarkService>(BookmarkService); | ||
authService = module.get<AuthService>(AuthService); | ||
controller = module.get<BookmarkController>(BookmarkController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(bookmarkService).toBeDefined(); | ||
expect(authService).toBeDefined(); | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { BookmarkService } from './bookmark.service'; | ||
import { PrismaService } from '../prisma/prisma.service'; | ||
|
||
class MockPrisma {} | ||
|
||
describe('BookmarkService', () => { | ||
let service: BookmarkService; | ||
let prisma: PrismaService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [BookmarkService], | ||
providers: [ | ||
BookmarkService, | ||
{ provide: PrismaService, useClass: MockPrisma }, | ||
], | ||
}).compile(); | ||
|
||
service = module.get<BookmarkService>(BookmarkService); | ||
prisma = module.get<PrismaService>(PrismaService); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(service).toBeDefined(); | ||
expect(prisma).toBeDefined(); | ||
}); | ||
}); |