-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 테스트를 date로 감싸고 invaildNumber에서 101보다 가까운 31로 수정
- Loading branch information
1 parent
ca4391b
commit 2531d0a
Showing
1 changed file
with
27 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
import { days } from './date'; | ||
|
||
describe('days', () => { | ||
const validNumbers = [ | ||
{ num: 1, word: '하루' }, | ||
{ num: 2, word: '이틀' }, | ||
{ num: 3, word: '사흘' }, | ||
{ num: 4, word: '나흘' }, | ||
{ num: 5, word: '닷새' }, | ||
{ num: 6, word: '엿새' }, | ||
{ num: 7, word: '이레' }, | ||
{ num: 8, word: '여드레' }, | ||
{ num: 9, word: '아흐레' }, | ||
{ num: 10, word: '열흘' }, | ||
{ num: 11, word: '열하루' }, | ||
{ num: 20, word: '스무날' }, | ||
{ num: 21, word: '스무하루' }, | ||
{ num: 30, word: '서른날' }, | ||
]; | ||
describe('date', () => { | ||
describe('days', () => { | ||
const validNumbers = [ | ||
{ num: 1, word: '하루' }, | ||
{ num: 2, word: '이틀' }, | ||
{ num: 3, word: '사흘' }, | ||
{ num: 4, word: '나흘' }, | ||
{ num: 5, word: '닷새' }, | ||
{ num: 6, word: '엿새' }, | ||
{ num: 7, word: '이레' }, | ||
{ num: 8, word: '여드레' }, | ||
{ num: 9, word: '아흐레' }, | ||
{ num: 10, word: '열흘' }, | ||
{ num: 11, word: '열하루' }, | ||
{ num: 20, word: '스무날' }, | ||
{ num: 21, word: '스무하루' }, | ||
{ num: 30, word: '서른날' }, | ||
]; | ||
|
||
const invalidNumbers = [0, -1, 101, 1.1, -1.1, Infinity, -Infinity, NaN]; | ||
const invalidNumbers = [0, -1, 31, 1.1, -1.1, Infinity, -Infinity, NaN]; | ||
|
||
validNumbers.forEach(({ num, word }) => { | ||
it(`${num} - 순 우리말 날짜 ${word}로 바꿔 반환해야 한다.`, () => { | ||
expect(days(num)).toBe(word); | ||
validNumbers.forEach(({ num, word }) => { | ||
it(`${num} - 순 우리말 날짜 ${word}로 바꿔 반환해야 한다.`, () => { | ||
expect(days(num)).toBe(word); | ||
}); | ||
}); | ||
}); | ||
|
||
invalidNumbers.forEach(num => { | ||
it(`유효하지 않은 숫자 ${num}에 대해 오류를 발생시켜야 한다.`, () => { | ||
expect(() => days(num)).toThrow('지원하지 않는 숫자입니다.'); | ||
invalidNumbers.forEach(num => { | ||
it(`유효하지 않은 숫자 ${num}에 대해 오류를 발생시켜야 한다.`, () => { | ||
expect(() => days(num)).toThrow('지원하지 않는 숫자입니다.'); | ||
}); | ||
}); | ||
}); | ||
}); |