From f50122409d89a4346181365c92b4c9f06bb00bbb Mon Sep 17 00:00:00 2001 From: kinndohyun Date: Tue, 25 Jun 2024 20:55:30 +0900 Subject: [PATCH 1/2] =?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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/amountToHangul.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/amountToHangul.spec.ts b/src/amountToHangul.spec.ts index 3d2de30b..fa06a50a 100644 --- a/src/amountToHangul.spec.ts +++ b/src/amountToHangul.spec.ts @@ -8,4 +8,10 @@ describe('amountToHangul', () => { expect(amountToHangul('100000000')).toEqual('일억'); expect(amountToHangul('100000100')).toEqual('일억백'); }); + + it('80자를 넘을 수 없다.', () => { + const testFn = () => + amountToHangul('123456789012345678901234567890123456789012345678901234567890123456789012345678901'); + expect(testFn).toThrowError(); + }); }); From 8f721446e2f9d97c4b62b729d354349410017c1b Mon Sep 17 00:00:00 2001 From: kinndohyun Date: Tue, 25 Jun 2024 21:06:14 +0900 Subject: [PATCH 2/2] =?UTF-8?q?test:=20amountToHangul=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/amountToHangul.spec.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/amountToHangul.spec.ts b/src/amountToHangul.spec.ts index fa06a50a..71fd12e5 100644 --- a/src/amountToHangul.spec.ts +++ b/src/amountToHangul.spec.ts @@ -9,9 +9,8 @@ describe('amountToHangul', () => { expect(amountToHangul('100000100')).toEqual('일억백'); }); - it('80자를 넘을 수 없다.', () => { - const testFn = () => - amountToHangul('123456789012345678901234567890123456789012345678901234567890123456789012345678901'); - expect(testFn).toThrowError(); + it('숫자로 된 금액이 80글자를 넘을 시 에러 발생', () => { + const longNumberString = '123456789012345678901234567890123456789012345678901234567890123456789012345678901'; + expect(() => amountToHangul(longNumberString)).toThrowError(`convert range exceeded : ${longNumberString}`); }); });