From 9b256b9f030974c5d3ccdf7630585c949741dd46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=84=ED=98=84?= <101170386+fe-dudu@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:27:28 +0900 Subject: [PATCH] =?UTF-8?q?test:=20amountToHangul=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80=20(#135)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: amountToHangul 테스트 추가 * test: amountToHangul 테스트 코드 수정 * test: amountToHangul 테스트 코드 스타일 변경 * test: amountToHangul test 개선 * fix: assert.throws대신 vitest toThrow로 메서드 변경 * fix: vitest toThrowError 메서드로 변경 --------- Co-authored-by: kinndohyun Co-authored-by: 박찬혁 --- src/amountToHangul.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/amountToHangul.spec.ts b/src/amountToHangul.spec.ts index 7be66a5e..0ba591a6 100644 --- a/src/amountToHangul.spec.ts +++ b/src/amountToHangul.spec.ts @@ -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('일십이만삼십'); });