Skip to content

Commit

Permalink
test: amountToHangul 테스트 추가 (#135)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people committed Jul 3, 2024
1 parent 11e0ba9 commit 9b256b9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/amountToHangul.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ describe('amountToHangul', () => {
expect(amountToHangul('100000100')).toEqual('일억백');
});

it('숫자로 된 금액이 80글자를 넘을 시 에러 발생', () => {
const longNumberString = '1'.repeat(81);
expect(() => amountToHangul(longNumberString)).toThrowError(`convert range exceeded : ${longNumberString}`);
})

it('숫자 외 문자를 무시하여 반환', () => {
expect(amountToHangul('120,030원')).toEqual('일십이만삼십');
});
Expand Down

0 comments on commit 9b256b9

Please sign in to comment.