[feature] stringToDate 유틸리티 함수 단위 테스트 추가#442
Conversation
- getTime() 결과가 NaN인 경우 예외 발생 - 사용자 입력이 잘못된 형식일 때 빠르게 원인 파악 가능 - 형식 예시 포함된 에러 메시지로 가독성 개선
- stringToDate: "YYYY.MM.DD HH:mm" 형식의 문자열을 Date 객체로 변환 - parseRecruitmentPeriod: 모집 기간 문자열을 시작일과 종료일로 파싱 - 날짜 형식 검증 및 에러 처리 로직 구현 - 단위 테스트 케이스 추가
|
Warning
|
| 파일/경로 그룹 | 변경 요약 |
|---|---|
| frontend/src/utils/stringToDate.ts | stringToDate 함수 도입, parseRecruitmentPeriod 함수 리팩토링 및 내보내기 방식 변경 |
| frontend/src/utils/parseRecruitmentPeriod.test.ts | parseRecruitmentPeriod 함수에 대한 단위 테스트 추가 |
| frontend/src/utils/recruitmentPeriodParser.test.ts | parseRecruitmentDateString 함수에 대한 단위 테스트 추가 |
| frontend/src/utils/recruitmentPeriodParser.ts.ts | parseRecruitmentDateString, parseRecruitmentPeriod 함수 신규 구현 및 내보내기 |
| frontend/src/pages/AdminPage/tabs/RecruitEditTab/RecruitEditTab.tsx frontend/src/pages/ClubDetailPage/components/ClubDetailFooter/ClubDetailFooter.tsx frontend/src/pages/ClubDetailPage/components/ClubDetailHeader/ClubDetailHeader.tsx |
parseRecruitmentPeriod 함수 import 경로를 recruitmentPeriodParser.ts.ts로 변경 |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Component
participant recruitmentPeriodParser
User->>Component: 날짜 문자열 전달
Component->>recruitmentPeriodParser: parseRecruitmentPeriod(문자열)
recruitmentPeriodParser->>recruitmentPeriodParser: parseRecruitmentDateString(시작/종료 문자열)
recruitmentPeriodParser-->>Component: { recruitmentStart, recruitmentEnd }
Component-->>User: 파싱된 날짜 반환/사용
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| 기존 stringToDate를 stringToDate와 parseRecruitmentPeriod 함수로 분리 (FE-123) | ✅ | |
| 각각의 함수 단위 테스트 작성 (FE-123) | ✅ |
Possibly related issues
- [feature] FE-123 stringToDate 유틸리티 함수 단위 테스트 추가 #441: stringToDate 및 parseRecruitmentPeriod 함수 분리 및 테스트 추가 요구사항과 본 PR의 변경사항이 일치합니다.
Suggested labels
🔨 Refactor
Suggested reviewers
- oesnuj
✨ Finishing Touches
- 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
✅ Deploy Preview for moadong ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
frontend/src/utils/parseRecruitmentPeriod.test.ts (1)
3-35: 테스트 케이스들이 잘 작성되었습니다!기본적인 시나리오들을 잘 커버하고 있습니다. 다만 몇 가지 추가 테스트 케이스를 고려해보시기 바랍니다.
stringToDate에서 예외가 발생하는 경우에 대한 테스트 케이스를 추가하는 것을 권장합니다:
it('잘못된 날짜 형식이 포함된 경우 null을 반환한다.', () => { const input = '2024.03.20 14:00 ~ 잘못된날짜'; const result = parseRecruitmentPeriod(input); expect(result.recruitmentStart).toBeNull(); expect(result.recruitmentEnd).toBeNull(); }); it('날짜 형식에 공백이 누락된 경우 null을 반환한다.', () => { const input = '2024.03.2014:00 ~ 2024.03.25 18:00'; const result = parseRecruitmentPeriod(input); expect(result.recruitmentStart).toBeNull(); expect(result.recruitmentEnd).toBeNull(); });frontend/src/utils/stringToDate.test.ts (1)
3-29: stringToDate 함수 테스트가 잘 작성되었습니다!기본적인 시나리오와 에러 케이스를 잘 커버하고 있습니다. 몇 가지 추가 엣지 케이스를 고려해보시면 더욱 견고한 테스트가 될 것 같습니다.
다음과 같은 추가 테스트 케이스들을 고려해보세요:
it('유효하지 않은 날짜 값이 주어지면 예외를 발생시킨다.', () => { const input = '2025.13.32 14:00'; expect(() => stringToDate(input)).toThrow( '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', ); }); it('유효하지 않은 시간 값이 주어지면 예외를 발생시킨다.', () => { const input = '2025.05.25 25:70'; expect(() => stringToDate(input)).toThrow( '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', ); }); it('날짜 부분만 있는 경우 예외를 발생시킨다.', () => { const input = '2025.05.25'; expect(() => stringToDate(input)).toThrow( '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', ); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
frontend/src/utils/parseRecruitmentPeriod.test.ts(1 hunks)frontend/src/utils/stringToDate.test.ts(1 hunks)frontend/src/utils/stringToDate.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
frontend/src/utils/parseRecruitmentPeriod.test.ts (1)
frontend/src/utils/stringToDate.ts (1)
parseRecruitmentPeriod(20-32)
frontend/src/utils/stringToDate.test.ts (1)
frontend/src/utils/stringToDate.ts (1)
stringToDate(1-18)
🔇 Additional comments (1)
frontend/src/utils/stringToDate.ts (1)
1-18: stringToDate 함수가 잘 구현되었습니다!함수가 명확한 책임을 가지고 있고, 입력 검증과 에러 처리가 적절히 구현되어 있습니다. 날짜 형식 변환 로직도 정확합니다.
- 날짜 부분 누락된 경우 - 빈 문자열인 경우
- JavaScript의 Date 객체는 자동으로 날짜를 조정하므로 불필요
oesnuj
left a comment
There was a problem hiding this comment.
유틸 함수 테스트 코드까지 꼼꼼히 챙겨주셔서 감사합니다!
수고하셨습니다~~
- 기존 split/replace/new Date 방식 제거 - date-fns의 parse와 isValid로 날짜 파싱 및 유효성 검사 일원화
- YYYY.MM.DD HH:mm 형식이 아닌 입력값에 대해 에러를 던지도록 정규식 검증 추가 - 잘못된 자리수의 날짜 문자열을 엄격하게 필터링
- YYYY.MM.DD HH:mm 형식이 아닌 입력값에 대해 예외가 발생하는지 검증
There was a problem hiding this comment.
Bug: Function Throws Errors for Malformed Dates
The parseRecruitmentPeriod function now throws errors for malformed date strings, a breaking change from its previous behavior. Previously, it returned Date objects (even if invalid) or null for malformed inputs, never throwing. This change is due to its reliance on the new stringToDate helper, which strictly validates and throws errors. This violates the function's return type contract (Date | null) and breaks existing tests that expect null returns for invalid cases. For example, inputs like "2024.03.20 14:00 ~ invalid-format" now throw errors.
frontend/src/utils/stringToDate.ts#L18-L31
moadong/frontend/src/utils/stringToDate.ts
Lines 18 to 31 in e7efb5c
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
frontend/src/utils/recruitmentPeriodParser.ts.ts (1)
19-31: parseRecruitmentPeriod 함수에서 에러 처리를 개선해야 합니다.현재
parseRecruitmentDateString이 에러를 던지면 전체 함수가 중단됩니다. 부분적으로 유효한 데이터라도 처리할 수 있도록 에러 처리를 개선하는 것을 고려해보세요.다음과 같은 개선안을 제안합니다:
export const parseRecruitmentPeriod = ( periodStr: string, ): { recruitmentStart: Date | null; recruitmentEnd: Date | null } => { const parts = periodStr.split('~').map((s) => s.trim()); if (parts.length !== 2) { return { recruitmentStart: null, recruitmentEnd: null }; } + const parseDate = (dateStr: string): Date | null => { + try { + return parseRecruitmentDateString(dateStr); + } catch { + return null; + } + }; + return { - recruitmentStart: parseRecruitmentDateString(parts[0]), - recruitmentEnd: parseRecruitmentDateString(parts[1]), + recruitmentStart: parseDate(parts[0]), + recruitmentEnd: parseDate(parts[1]), }; };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
frontend/src/pages/AdminPage/tabs/RecruitEditTab/RecruitEditTab.tsx(1 hunks)frontend/src/pages/ClubDetailPage/components/ClubDetailFooter/ClubDetailFooter.tsx(1 hunks)frontend/src/pages/ClubDetailPage/components/ClubDetailHeader/ClubDetailHeader.tsx(1 hunks)frontend/src/utils/parseRecruitmentPeriod.test.ts(1 hunks)frontend/src/utils/recruitmentPeriodParser.test.ts(1 hunks)frontend/src/utils/recruitmentPeriodParser.ts.ts(1 hunks)
✅ Files skipped from review due to trivial changes (4)
- frontend/src/pages/AdminPage/tabs/RecruitEditTab/RecruitEditTab.tsx
- frontend/src/pages/ClubDetailPage/components/ClubDetailHeader/ClubDetailHeader.tsx
- frontend/src/pages/ClubDetailPage/components/ClubDetailFooter/ClubDetailFooter.tsx
- frontend/src/utils/parseRecruitmentPeriod.test.ts
🧰 Additional context used
📓 Path-based instructions (1)
frontend/**/*.{ts,tsx}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- frontend/.cursorrules
🧠 Learnings (2)
📓 Common learnings
Learnt from: seongwon030
PR: Moadong/moadong#418
File: frontend/src/mocks/api/clubHandlers.test.ts:0-0
Timestamp: 2025-05-16T06:25:11.193Z
Learning: 이 프로젝트에서는 API URL 생성과 같은 유틸리티 함수는 별도 파일로 분리하여 관리하는 것이 좋습니다. 특히 테스트 파일 내에 정의된 유틸리티 함수는 재사용성과 일관성을 위해 분리가 권장됩니다.
frontend/src/utils/recruitmentPeriodParser.ts.ts (1)
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-07T13:25:48.117Z
Learning: Applies to frontend/**/*.{ts,tsx} : Replace magic numbers with named constants for clarity.
🧬 Code Graph Analysis (1)
frontend/src/utils/recruitmentPeriodParser.test.ts (1)
frontend/src/utils/recruitmentPeriodParser.ts.ts (1)
parseRecruitmentDateString(3-17)
🔇 Additional comments (1)
frontend/src/utils/recruitmentPeriodParser.test.ts (1)
4-8: 포괄적인 테스트 케이스로 잘 작성되었습니다.정상적인 날짜 파싱 케이스와 다양한 에러 시나리오를 모두 다루고 있어 함수의 동작을 충분히 검증하고 있습니다. 특히 자정 시간, 공백 누락, 부분적 입력 누락 등의 엣지 케이스까지 고려한 점이 좋습니다.
Also applies to: 10-14, 16-21, 23-28, 30-35, 37-42, 44-49
| @@ -0,0 +1,50 @@ | |||
| import { parseRecruitmentDateString } from './recruitmentPeriodParser.ts'; | |||
|
|
|||
| describe('parseRecruitmentPeriod 함수 테스트', () => { | |||
There was a problem hiding this comment.
describe 블록 이름이 실제 테스트하는 함수와 일치하지 않습니다.
describe 블록에서 "parseRecruitmentPeriod 함수 테스트"라고 되어 있지만, 실제로는 parseRecruitmentDateString 함수를 테스트하고 있습니다.
다음과 같이 수정해주세요:
-describe('parseRecruitmentPeriod 함수 테스트', () => {
+describe('parseRecruitmentDateString 함수 테스트', () => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| describe('parseRecruitmentPeriod 함수 테스트', () => { | |
| describe('parseRecruitmentDateString 함수 테스트', () => { |
🤖 Prompt for AI Agents
In frontend/src/utils/recruitmentPeriodParser.test.ts at line 3, the describe
block name incorrectly references "parseRecruitmentPeriod" while the tests are
actually for the function "parseRecruitmentDateString". Rename the describe
block to accurately reflect the tested function by changing the text to
"parseRecruitmentDateString 함수 테스트".
| const result = new Date('2025-05-25T13:45:00'); | ||
| expect(parseRecruitmentDateString(input)).toEqual(result); |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
시간대 문제로 인한 테스트 불안정성 가능성을 확인해주세요.
테스트에서 new Date('2025-05-25T13:45:00')와 같이 ISO 문자열로 Date 객체를 생성하고 있는데, 이는 로컬 시간대에 따라 다르게 해석될 수 있습니다. parseRecruitmentDateString 함수도 로컬 시간대를 기준으로 파싱하므로 환경에 따라 테스트가 실패할 수 있습니다.
다음 스크립트로 시간대 문제가 있는지 확인해보겠습니다:
Also applies to: 12-13
🏁 Script executed:
#!/bin/bash
# Description: 테스트 파일의 Date 객체 생성 방식 확인
# Test: Date 객체 생성 패턴 검색
rg -A 2 -B 2 "new Date\(" frontend/src/utils/recruitmentPeriodParser.test.tsLength of output: 513
🏁 Script executed:
#!/bin/bash
# Retrieve the implementation of parseRecruitmentDateString for timezone behavior analysis
rg -n "parseRecruitmentDateString" -A5 -B5 frontend/src/utils/recruitmentPeriodParser.tsLength of output: 174
🏁 Script executed:
#!/bin/bash
# Search for parseRecruitmentDateString implementation across the repo
rg -n "parseRecruitmentDateString" -A5 -B5Length of output: 5713
🏁 Script executed:
#!/bin/bash
# List files in the utils directory
echo "Files in frontend/src/utils:"
ls -1 frontend/src/utils
# Print the content of the parser implementation file(s)
echo -e "\nContent of recruitmentPeriodParser.ts:"
sed -n '1,200p' frontend/src/utils/recruitmentPeriodParser.ts || echo "frontend/src/utils/recruitmentPeriodParser.ts not found"
echo -e "\nContent of recruitmentPeriodParser.ts.ts:"
sed -n '1,200p' frontend/src/utils/recruitmentPeriodParser.ts.ts || echo "frontend/src/utils/recruitmentPeriodParser.ts.ts not found"Length of output: 1734
테스트의 Date 생성 방식이 로컬 타임존에 종속되어 있어 환경별로 실패할 수 있습니다
ISO 문자열('2025-05-25T13:45:00')로 Date 객체를 만들면 UTC 기준으로 해석되고, date-fns의 parse는 로컬 타임존 기준으로 파싱하기에 타임존에 따라 getTime() 값이 달라집니다. 숫자 인자를 사용하는 생성자 호출로 바꿔 로컬 타임존 의존성을 제거해주세요.
수정 위치:
- frontend/src/utils/recruitmentPeriodParser.test.ts (라인 5–7, 11–13)
제안 드리는 diff:
it('날짜와 시간이 포함된 문자열을 Date 객체로 정확히 바꾼다', () => {
const input = '2025.05.25 13:45';
- const result = new Date('2025-05-25T13:45:00');
+ const result = new Date(2025, 4, 25, 13, 45);
expect(parseRecruitmentDateString(input)).toEqual(result);
});
it('자정 시간 "YYYY.MM.DD 00:00" 형식을 올바르게 Date 객체로 변환한다', () => {
const input = '2025.05.25 00:00';
- const result = new Date('2025-05-25T00:00:00');
+ const result = new Date(2025, 4, 25, 0, 0);
expect(parseRecruitmentDateString(input)).toEqual(result);
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const result = new Date('2025-05-25T13:45:00'); | |
| expect(parseRecruitmentDateString(input)).toEqual(result); | |
| it('날짜와 시간이 포함된 문자열을 Date 객체로 정확히 바꾼다', () => { | |
| const input = '2025.05.25 13:45'; | |
| - const result = new Date('2025-05-25T13:45:00'); | |
| + const result = new Date(2025, 4, 25, 13, 45); | |
| expect(parseRecruitmentDateString(input)).toEqual(result); | |
| }); | |
| it('자정 시간 "YYYY.MM.DD 00:00" 형식을 올바르게 Date 객체로 변환한다', () => { | |
| const input = '2025.05.25 00:00'; | |
| - const result = new Date('2025-05-25T00:00:00'); | |
| + const result = new Date(2025, 4, 25, 0, 0); | |
| expect(parseRecruitmentDateString(input)).toEqual(result); | |
| }); |
🤖 Prompt for AI Agents
In frontend/src/utils/recruitmentPeriodParser.test.ts around lines 5 to 7 and 11
to 13, the test creates Date objects using ISO strings which are interpreted as
UTC, causing timezone-dependent failures. Replace these Date constructions with
numeric arguments (year, month, day, hour, minute, second) to create Date
objects in the local timezone and remove timezone dependency from the tests.
| throw new Error( | ||
| '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.', | ||
| ); |
There was a problem hiding this comment.
🛠️ Refactor suggestion
중복된 에러 메시지를 상수로 추출해야 합니다.
동일한 에러 메시지가 두 곳에서 반복되고 있습니다. DRY 원칙에 따라 상수로 추출하는 것이 좋습니다.
다음과 같이 수정해주세요:
+const INVALID_DATE_FORMAT_ERROR = '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.';
+
export const parseRecruitmentDateString = (s: string): Date => {
const regex = /^\d{4}\.\d{2}\.\d{2} \d{2}:\d{2}$/;
if (!regex.test(s)) {
- throw new Error(
- '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.',
- );
+ throw new Error(INVALID_DATE_FORMAT_ERROR);
}
const date = parse(s, 'yyyy.MM.dd HH:mm', new Date());
if (!isValid(date)) {
- throw new Error(
- '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD HH:mm" 이어야 합니다.',
- );
+ throw new Error(INVALID_DATE_FORMAT_ERROR);
}Also applies to: 12-14
🤖 Prompt for AI Agents
In frontend/src/utils/recruitmentPeriodParser.ts.ts around lines 6 to 8 and also
lines 12 to 14, the error message string '유효하지 않은 날짜 형식입니다. 형식은 "YYYY.MM.DD
HH:mm" 이어야 합니다.' is duplicated. To follow the DRY principle, extract this error
message into a constant at the top of the file and replace all occurrences of
the string with this constant.
| import { parse, isValid } from 'date-fns'; | ||
|
|
||
| export const parseRecruitmentDateString = (s: string): Date => { | ||
| const regex = /^\d{4}\.\d{2}\.\d{2} \d{2}:\d{2}$/; |
There was a problem hiding this comment.
🛠️ Refactor suggestion
정규식 패턴을 명명된 상수로 추출해야 합니다.
코딩 가이드라인에 따라 매직 넘버와 문자열을 명명된 상수로 교체해야 합니다. 정규식 패턴을 상수로 추출하면 가독성과 재사용성이 향상됩니다.
다음과 같이 수정해주세요:
+const DATE_TIME_REGEX = /^\d{4}\.\d{2}\.\d{2} \d{2}:\d{2}$/;
+
export const parseRecruitmentDateString = (s: string): Date => {
- const regex = /^\d{4}\.\d{2}\.\d{2} \d{2}:\d{2}$/;
- if (!regex.test(s)) {
+ if (!DATE_TIME_REGEX.test(s)) {🤖 Prompt for AI Agents
In frontend/src/utils/recruitmentPeriodParser.ts.ts at line 4, the regex pattern
is currently a magic string. Extract this regex pattern into a named constant at
the top of the file to improve readability and reusability. Replace the inline
regex with this constant in the code.
| @@ -0,0 +1,31 @@ | |||
| import { parse, isValid } from 'date-fns'; | |||
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
파일명의 확장자를 확인해주세요.
파일명이 recruitmentPeriodParser.ts.ts로 되어 있는데, .ts.ts는 잘못된 확장자입니다. .ts만 사용해야 합니다.
다음 스크립트로 파일명을 확인해보겠습니다:
🏁 Script executed:
#!/bin/bash
# Description: 중복된 .ts 확장자를 가진 파일 확인
# Test: .ts.ts 확장자를 가진 파일 검색
fd "\.ts\.ts$" frontend/src/Length of output: 79
파일명 확장자 중복 제거 요청
.ts.ts로 잘못 설정된 파일명을 단일 .ts 확장자로 변경해주세요.
- 수정 대상
- frontend/src/utils/recruitmentPeriodParser.ts.ts
→ frontend/src/utils/recruitmentPeriodParser.ts
- frontend/src/utils/recruitmentPeriodParser.ts.ts
- 변경 후 해당 모듈을 import 하는 경로도 모두
.ts확장자로 업데이트되었는지 검토 바랍니다.
- frontend/src/utils/recruitmentPeriodParser.ts.ts
+ frontend/src/utils/recruitmentPeriodParser.ts🤖 Prompt for AI Agents
In frontend/src/utils/recruitmentPeriodParser.ts.ts at line 1, the file
extension is mistakenly duplicated as .ts.ts. Rename the file to have a single
.ts extension, changing it to frontend/src/utils/recruitmentPeriodParser.ts.
After renaming, update all import statements throughout the codebase that
reference this module to use the corrected .ts extension path.

#️⃣연관된 이슈
📝작업 내용
유틸리티 함수 분리
parseRecruitmentPeriod하나로 구성된 날짜변환 유틸함수를 2개의 유틸함수로 분리했습니다.parseRecruitmentPeriod유지convertToDate를stringToDate로 이름을 바꾸고 분리했습니다.이유
✔️유틸함수가 두 번의 과정을 거칩니다.
이 과정에서 같은 변수를 사용하기에 의존적입니다. 또한, 단위테스트 작성이 어렵습니다.
독립 테스트 필요
parseRecruitmentPeriod테스트 실패 시 원인이stringToDate인지 추적하기 어렵습니다.stringToDate구현이 바뀔 시parseRecruitmentPeriod테스트가 통과해도stringToDate가 제대로 동작하는지 알기 어렵습니다.단위테스트 작성하기
throw Error추가 24930ef중점적으로 리뷰받고 싶은 부분(선택)
논의하고 싶은 부분(선택)
🫡 참고사항
Summary by CodeRabbit
신규 기능
버그 수정
테스트
리팩터
기타