-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: amountToHangul 테스트 추가 #135
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/amountToHangul.spec.ts
Outdated
|
||
it('숫자로 된 금액이 80글자를 넘을 시 에러 발생', () => { | ||
const longNumberString = '1'.repeat(81); | ||
assert.throws(() => amountToHangul(longNumberString), Error, `convert range exceeded : ${longNumberString}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 프로젝트에서 사용하는 vitest가 제공해주는 toThrow
메서드가 아닌, assert를 사용하면 어떠한 이점이 있나요?
제가 생각한건 다음과 같아요.
expect(() => amountToHangul(longNumberString)).toThrow(`convert range exceeded : ${longNumberString}`);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
특별한 이점은 없고 combineHangulCharacter.spec.ts
, hangul.spec.ts
에서 node 기본 모듈인 assert의 throws
메서드를 사용하다보니 동일하게 사용하려고 했습니다. vitest에서 제공해주는 toThrow
메서드를 사용하는 것이 일관성이 있을 것 같아요 !
combineHangulCharacter.spec.ts
, hangul.spec.ts
에서도 assert.throws
대신 toThrow
메서드를 사용하도록 변경되면 좋을 것 같은데 추가로 PR 올려도 괜찮을까요 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@okinawaa 님 이건 좀 다른 주제이긴 한데요. vitest에서 제공하는 toThrow
는 toThrowError
의 별칭인데요. 현재 테스트 코드 대다수에서 toThrowError
를 사용하고 있는데 하나로 통일하여 일관성을 지키는게 좋지 않을까 싶은데 어떠신가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두 메서드는 동일하지만 error를 테스트할때 toThrowError
를 사용하는 것이 직관적이겠네요 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
감사합니다
conflic해결만 부탁드립니다 @fe-dudu |
* test: amountToHangul 테스트 추가 * test: amountToHangul 테스트 코드 수정 * test: amountToHangul 테스트 코드 스타일 변경 * test: amountToHangul test 개선 * fix: assert.throws대신 vitest toThrow로 메서드 변경 * fix: vitest toThrowError 메서드로 변경 --------- Co-authored-by: kinndohyun <[email protected]> Co-authored-by: 박찬혁 <[email protected]>
Overview
amountToHangul 함수의 error case test를 추가하여 Uncovered Line을 제거합니다.
PR Checklist