|
1 | | -import { stringToDate } from './stringToDate'; |
| 1 | +import { parseRecruitmentDateString } from './recruitmentPeriodParser.ts'; |
2 | 2 |
|
3 | | -describe('stringToDate 함수 테스트', () => { |
| 3 | +describe('parseRecruitmentPeriod 함수 테스트', () => { |
4 | 4 | it('날짜와 시간이 포함된 문자열을 Date 객체로 정확히 바꾼다', () => { |
5 | 5 | const input = '2025.05.25 13:45'; |
6 | 6 | const result = new Date('2025-05-25T13:45:00'); |
7 | | - expect(stringToDate(input)).toEqual(result); |
| 7 | + expect(parseRecruitmentDateString(input)).toEqual(result); |
8 | 8 | }); |
9 | 9 |
|
10 | 10 | it('자정 시간 "YYYY.MM.DD 00:00" 형식을 올바르게 Date 객체로 변환한다', () => { |
11 | 11 | const input = '2025.05.25 00:00'; |
12 | 12 | const result = new Date('2025-05-25T00:00:00'); |
13 | | - expect(stringToDate(input)).toEqual(result); |
| 13 | + expect(parseRecruitmentDateString(input)).toEqual(result); |
14 | 14 | }); |
15 | 15 |
|
16 | 16 | it('공백이 없는 문자열이라면 예외가 발생한다.', () => { |
17 | 17 | const input = '2025.05.2513:45'; |
18 | | - expect(() => stringToDate(input)).toThrow( |
| 18 | + expect(() => parseRecruitmentDateString(input)).toThrow( |
19 | 19 | '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', |
20 | 20 | ); |
21 | 21 | }); |
22 | 22 |
|
23 | 23 | it('시간 부분이 누락된 경우 예외가 발생한다', () => { |
24 | 24 | const input = '2025.05.25 '; |
25 | | - expect(() => stringToDate(input)).toThrow( |
| 25 | + expect(() => parseRecruitmentDateString(input)).toThrow( |
26 | 26 | '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', |
27 | 27 | ); |
28 | 28 | }); |
29 | 29 |
|
30 | 30 | it('날짜 부분이 누락된 경우 예외가 발생한다', () => { |
31 | 31 | const input = ' 13:45'; |
32 | | - expect(() => stringToDate(input)).toThrow( |
| 32 | + expect(() => parseRecruitmentDateString(input)).toThrow( |
33 | 33 | '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', |
34 | 34 | ); |
35 | 35 | }); |
36 | 36 |
|
37 | 37 | it('빈 문자열이 주어지면 예외가 발생한다', () => { |
38 | 38 | const input = ''; |
39 | | - expect(() => stringToDate(input)).toThrow( |
| 39 | + expect(() => parseRecruitmentDateString(input)).toThrow( |
40 | 40 | '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', |
41 | 41 | ); |
42 | 42 | }); |
43 | 43 |
|
44 | 44 | it('YYYY.MM.DD HH:mm 형식이 아닌 입력에 대해 에러를 던진다', () => { |
45 | 45 | const input = '1.1.1 1:1'; |
46 | | - expect(() => stringToDate(input)).toThrow( |
| 46 | + expect(() => parseRecruitmentDateString(input)).toThrow( |
47 | 47 | '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', |
48 | 48 | ); |
49 | 49 | }); |
|
0 commit comments