Skip to content

Commit

Permalink
blog: NestJS에서 단위 테스트 작성하기 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JHyeok committed Nov 2, 2024
1 parent cc923b0 commit 9a508f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions content/blog/nestjs-unit-test/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe('UserService', () => {
providers: [UserService, UserRepository],
}).compile();
userService = module.get<UserService>(UserService);
userRepository = module.get<UserRepository>(UserRepository);
userService = module.get(UserService);
userRepository = module.get(UserRepository);
});
}
```
Expand Down Expand Up @@ -68,8 +68,8 @@ async update(
): Promise<User> {
const user = await this.userRepository.findOneByUserId(userId);

if (isEmpty(user) === true) {
throw new NotFoundException(UserMessage.NOT_FOUND_USER);
if (!user) {
throw new NotFoundException(UserMessage.USER_NOT_FOUND);
}

const { firstName, lastName, isActive } = requestDto;
Expand All @@ -95,7 +95,7 @@ describe('UserService', () => {
};
await expect(result).rejects.toThrowError(
new NotFoundException(UserMessage.NOT_FOUND_USER),
new NotFoundException(UserMessage.USER_NOT_FOUND),
);
});
});
Expand Down

0 comments on commit 9a508f7

Please sign in to comment.