Skip to content

Commit

Permalink
Extract mockUser
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Aug 18, 2024
1 parent 4e029bc commit 3b3e4ca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions violet-server/src/comment/comment.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('CommentController', () => {
let module: TestingModule;
let controller: CommentController;
let userRepository: UserRepository;
let mockUser: User;

beforeEach(async () => {
module = await Test.createTestingModule({
Expand Down Expand Up @@ -43,6 +44,10 @@ describe('CommentController', () => {

controller = module.get<CommentController>(CommentController);
userRepository = module.get<UserRepository>(UserRepository);

mockUser = await userRepository.createUser({
userAppId: 'test',
});
});

it('should be defined', () => {
Expand All @@ -51,9 +56,6 @@ describe('CommentController', () => {
});

it('post comment', async () => {
let mockUser = await userRepository.createUser({
userAppId: 'test',
});
let res = await controller.postComment(mockUser, {
where: 'general',
body: 'test',
Expand Down

0 comments on commit 3b3e4ca

Please sign in to comment.