Skip to content

Comments

[test] 날짜 파싱 테스트 타임존 문제를 해결한다#880

Merged
seongwon030 merged 2 commits intodevelop-fefrom
fix/#879-parse-recruitment-period-test-timezone-MOA-371
Nov 22, 2025
Merged

[test] 날짜 파싱 테스트 타임존 문제를 해결한다#880
seongwon030 merged 2 commits intodevelop-fefrom
fix/#879-parse-recruitment-period-test-timezone-MOA-371

Conversation

@seongwon030
Copy link
Member

@seongwon030 seongwon030 commented Nov 22, 2025

#️⃣연관된 이슈

ex) #879

📝작업 내용

실패하는 테스트

스크린샷 2025-11-22 오후 5 17 41

원인

parseRecruitmentDateString함수에서 반환하는 date 값입니다.

const date = parse(s + ' +0000', 'yyyy.MM.dd HH:mm X', new Date());

+0000은 UTC 오프셋입니다. 함수는 이미 UTC로 파싱하며, 반환되는 Date 객체는 UTC 시간입니다.

하지만 테스트 내부에서는 타임존 정보 없이 반환하기에 로컬 타임존으로 해석하게 됩니다.

new Date('2024-03-20T14:00:00')  // 타임존 정보 없음 → 로컬 타임존(KST)으로 해석
// = 2024-03-20T14:00:00 KST = 2024-03-20T05:00:00 UTC

그래서 타임존을 명시하여 UTC를 명시하도록 했습니다.

new Date('2024-03-20T14:00:00Z')  // Z = UTC 명시
// = 2024-03-20T14:00:00 UTC

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

릴리스 노트

이 릴리스에는 최종 사용자에게 영향을 미치는 기능 변경이 없습니다.

  • Tests
    • 테스트 기대값이 업데이트되어 UTC 타임존 표기를 명시적으로 포함하도록 변경되었습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

- applyHandlers.test.ts → applyHandlers.test.skip.ts로 변경
- 테스트 목록에서 제외
- 테스트의 예상값 Date 객체에 UTC 표시(Z) 추가
- parseRecruitmentPeriod.test.ts, recruitmentPeriodParser.test.ts 수정
- 로컬 타임존과 무관하게 테스트가 통과하도록 개선
@seongwon030 seongwon030 self-assigned this Nov 22, 2025
@seongwon030 seongwon030 added ✅ Test test 관련(storybook, jest...) 💻 FE Frontend labels Nov 22, 2025
@vercel
Copy link

vercel bot commented Nov 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
moadong Ready Ready Preview Comment Nov 22, 2025 8:34am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

두 개의 날짜 파싱 테스트 파일의 기대 값이 업데이트되어 UTC 타임존 표시기("Z")를 명시적으로 포함합니다. 이전에는 타임존 접미사 없이 ISO 형식 문자열이 사용되었으나, 이제 UTC 표시가 추가되었습니다.

Changes

Cohort / File(s) Summary
테스트 기대 값 업데이트
frontend/src/utils/parseRecruitmentPeriod.test.ts, frontend/src/utils/recruitmentPeriodParser.test.ts
성공적인 날짜 파싱 테스트의 기대 값이 명시적 UTC 접미사("Z")를 포함하도록 업데이트 (예: 2025-05-25T13:45:00Z, 2025-05-25T00:00:00Z)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • 테스트 기대 값의 단순한 일관성 업데이트로, 구현 로직 변경 없음
  • 동일한 패턴의 반복적인 변경으로 검토 복잡도 낮음

Possibly related issues

  • MOA-371: 날짜 파싱 테스트의 타임존 문제를 해결하기 위해 UTC 표시를 명시적으로 추가하는 작업과 직접적으로 일치

Possibly related PRs

Suggested reviewers

  • oesnuj
  • lepitaaar
  • Zepelown

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 내용을 명확히 설명하고 있습니다. 테스트의 타임존 문제 해결이라는 핵심 변경사항을 정확하게 반영하고 있습니다.
Linked Issues check ✅ Passed PR이 연결된 이슈 MOA-371의 요구사항을 충족합니다. 테스트 코드에서 UTC 타임존을 명시적으로 표기하여 타임존 문제를 해결했습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 타임존 문제 해결이라는 범위 내에 있습니다. 테스트 파일의 예상값 업데이트만 포함되어 있어 범위를 벗어난 변경사항이 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#879-parse-recruitment-period-test-timezone-MOA-371

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 504f573 and dfeb683.

📒 Files selected for processing (2)
  • frontend/src/utils/parseRecruitmentPeriod.test.ts (1 hunks)
  • frontend/src/utils/recruitmentPeriodParser.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/utils/recruitmentPeriodParser.test.ts (1)
frontend/src/utils/recruitmentPeriodParser.ts (1)
  • parseRecruitmentDateString (3-17)
🔇 Additional comments (3)
frontend/src/utils/parseRecruitmentPeriod.test.ts (1)

8-9: 타임존 불일치 문제를 정확하게 해결했습니다.

parseRecruitmentDateString 구현체가 parse(s + ' +0000', ...) 형태로 UTC 오프셋을 명시적으로 추가하여 파싱하므로, 테스트의 기대값도 UTC 기준이어야 합니다. 'Z' 접미사를 추가하여 Date 생성자가 UTC로 해석하도록 수정한 것은 올바른 해결책입니다.

frontend/src/utils/recruitmentPeriodParser.test.ts (2)

6-6: UTC 타임존이 올바르게 명시되었습니다.

구현체가 UTC 기준으로 날짜를 파싱하므로, 테스트의 기대값에 'Z'를 추가하여 UTC임을 명시한 것이 정확합니다.


12-12: 자정(00:00) 케이스도 정확하게 수정되었습니다.

자정 시간의 경우 타임존 차이가 날짜 경계를 넘을 수 있어 특히 중요한데, UTC 표시를 명시하여 올바르게 처리했습니다.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@lepitaaar lepitaaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트코드 수정 수고하셨습니다 타임존 차이로 실패하는게 신기하네요. 시간을다루는건 항상 어려운거같아요 😢😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend ✅ Test test 관련(storybook, jest...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] MOA-371 날짜 파싱 테스트 타임존 문제를 해결한다

2 participants