Skip to content

[test] 날짜 포맷팅 테스트 케이스 추가#1378

Open
seongwon030 wants to merge 1 commit intodevelop-fefrom
feature/#1377-calendar-test-MOA-781
Open

[test] 날짜 포맷팅 테스트 케이스 추가#1378
seongwon030 wants to merge 1 commit intodevelop-fefrom
feature/#1377-calendar-test-MOA-781

Conversation

@seongwon030
Copy link
Copy Markdown
Member

@seongwon030 seongwon030 commented Apr 3, 2026

#️⃣연관된 이슈

ex) #1377

📝작업 내용

  1. formatDateText - 유효한 날짜 한국어 로케일 포맷
  2. formatDateOnly - YYYY-MM-DD 표시용 형식 변환 (정상/비정상 케이스)
  3. convertGoogleEventToUnified - Google 이벤트 통합 변환 (정상/잘못된 날짜)
  4. convertNotionEventToUnified - Notion 이벤트 통합 변환 (정상/선택적 필드)

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

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

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

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

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

🫡 참고사항

Summary by CodeRabbit

릴리스 노트

이 업데이트는 내부 테스트 강화에 중점을 두었습니다.

  • Tests
    • 캘린더 동기화 유틸리티에 대한 테스트 커버리지 확대
    • 날짜 포맷팅 기능에 대한 테스트 추가
    • Google 및 Notion 이벤트 변환 로직 검증 추가

- Google Calendar 및 Notion 이벤트를 통합 형식으로 변환하는 함수 추가
- formatDateOnly 함수에 대한 테스트 케이스 작성
- 한국어 로케일에 맞춘 날짜 포맷팅 테스트 케이스 추가
@seongwon030 seongwon030 self-assigned this Apr 3, 2026
@seongwon030 seongwon030 added ✅ Test test 관련(storybook, jest...) 💻 FE Frontend labels Apr 3, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2026

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

Project Deployment Actions Updated (UTC)
moadong Ready Ready Preview, Comment Apr 3, 2026 4:46pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

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

캘린더 동기화 유틸리티의 테스트 파일을 업데이트하여 새로운 공개 타입(GoogleCalendarEvent)과 변환 유틸리티(convertGoogleEventToUnified, convertNotionEventToUnified), 날짜 포맷팅 유틸리티(formatDateOnly)에 대한 테스트 커버리지를 추가했습니다.

Changes

Cohort / File(s) Summary
캘린더 동기화 테스트
frontend/src/utils/calendarSyncUtils.test.ts
Google 및 Notion 이벤트를 통합 형식으로 변환하는 함수들에 대한 테스트 추가. 날짜 포맷팅(formatDateOnly), Google 이벤트 변환(ID 접두사, dateKey 생성, 필드 통과), Notion 이벤트 변환(필드 매핑 및 기본값 설정), 불완전한 데이터 처리에 대한 검증 포함.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • lepitaaar
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 테스트 케이스 추가에 대한 내용을 명확하게 설명하고 있으며, 변경 사항의 주요 초점인 날짜 포맷팅 테스트와 일치합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/#1377-calendar-test-MOA-781

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

🎨 UI 변경사항을 확인해주세요

변경된 스토리를 Chromatic에서 확인해주세요.

구분 링크
🔍 변경사항 리뷰 https://www.chromatic.com/build?appId=67904e61c16daa99a63b44a7&number=140
📖 Storybook https://67904e61c16daa99a63b44a7-mclewmbvhg.chromatic.com/

4개 스토리 변경 · 전체 56개 스토리 · 22개 컴포넌트

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
frontend/src/utils/calendarSyncUtils.test.ts (2)

183-191: ID 픽스처가 실제 계약보다 과하게 prefix 친화적이라 테스트 의도가 흐려집니다.

입력 ID를 이미 google-... / notion-... 형태로 두고 google-google-... / notion-notion-...를 기대하면, 실제 계약(원본 ID + 단일 prefix 부여) 검증력이 약해집니다. 특히 useUnifiedCalendarUiState의 단일 .replace('google-', '') / .replace('notion-', '') 흐름과 맞물려 회귀 탐지가 어려워질 수 있습니다.

픽스처 현실성 개선 예시 diff
 const googleEvent: GoogleCalendarEvent = {
-  id: 'google-event-1',
+  id: 'event-1',
   title: 'Google 미팅',
   start: '2026-03-20T10:00:00Z',
   end: '2026-03-20T11:00:00Z',
-  url: 'https://calendar.google.com/event?id=google-event-1',
+  url: 'https://calendar.google.com/event?id=event-1',
   description: '팀 회의',
   source: 'GOOGLE',
 };

 ...
-expect(unified?.id).toBe('google-google-event-1');
+expect(unified?.id).toBe('google-event-1');

 const notionEvent = {
-  id: 'notion-page-1',
+  id: 'page-1',
   title: 'Notion 작업',
   start: '2026-03-21',
   dateKey: '2026-03-21',
   end: '2026-03-22',
   url: 'https://www.notion.so/page-1',
 };

 ...
-expect(unified.id).toBe('notion-notion-page-1');
+expect(unified.id).toBe('notion-page-1');

Also applies to: 196-196, 219-226, 230-230, 249-249

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/utils/calendarSyncUtils.test.ts` around lines 183 - 191, The
test fixtures use already-prefixed IDs (e.g., 'google-event-1',
'notion-event-1') which masks the real contract of adding a single provider
prefix in useUnifiedCalendarUiState; update the Google/Notion event fixtures
(symbols: googleEvent, notionEvent and any similar fixtures around the noted
ranges) to use raw IDs without provider prefixes (e.g., 'event-1'), and adjust
the expected IDs in assertions to match a single prefixed form produced by the
code (e.g., 'google-event-1' or 'notion-event-1'), ensuring the test exercises
the .replace('google-', '') / .replace('notion-', '') behavior correctly across
all referenced fixtures.

86-91: 로케일 포맷 테스트가 너무 느슨해서 회귀를 놓칠 수 있습니다.

현재 toContain('3'), toContain('19')는 다른 포맷(심지어 비한국어 포맷)도 통과할 수 있습니다. ko-KR 기준 날짜 파트를 기준값으로 만들어 검증하는 편이 더 안전합니다.

테스트 강화를 위한 예시 diff
 it('유효한 날짜는 한국어 로케일로 포맷한다', () => {
-  const result = formatDateText('2026-03-19T10:30:00Z');
-  expect(result).toContain('2026');
-  expect(result).toContain('3');
-  expect(result).toContain('19');
+  const input = '2026-03-19T10:30:00Z';
+  const result = formatDateText(input);
+  const expectedDatePart = new Intl.DateTimeFormat('ko-KR', {
+    year: 'numeric',
+    month: 'numeric',
+    day: 'numeric',
+  }).format(new Date(input));
+  expect(result).toContain(expectedDatePart);
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/utils/calendarSyncUtils.test.ts` around lines 86 - 91, The test
for formatDateText is too loose (it only asserts contains '3' and '19') and can
pass for non-Korean formats; update the test to assert against an explicit ko-KR
formatted output instead. Specifically, call
formatDateText('2026-03-19T10:30:00Z') and compare the result to the expected
string assembled using Intl.DateTimeFormat('ko-KR', { year:'numeric',
month:'numeric', day:'numeric', hour:'numeric', minute:'numeric' }) or to the
known expected literal (e.g., "2026년 3월 19일 ...") so the assertion checks exact
date parts for the ko-KR locale rather than loose contains checks; update the
test case in calendarSyncUtils.test.ts that references formatDateText
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/src/utils/calendarSyncUtils.test.ts`:
- Around line 183-191: The test fixtures use already-prefixed IDs (e.g.,
'google-event-1', 'notion-event-1') which masks the real contract of adding a
single provider prefix in useUnifiedCalendarUiState; update the Google/Notion
event fixtures (symbols: googleEvent, notionEvent and any similar fixtures
around the noted ranges) to use raw IDs without provider prefixes (e.g.,
'event-1'), and adjust the expected IDs in assertions to match a single prefixed
form produced by the code (e.g., 'google-event-1' or 'notion-event-1'), ensuring
the test exercises the .replace('google-', '') / .replace('notion-', '')
behavior correctly across all referenced fixtures.
- Around line 86-91: The test for formatDateText is too loose (it only asserts
contains '3' and '19') and can pass for non-Korean formats; update the test to
assert against an explicit ko-KR formatted output instead. Specifically, call
formatDateText('2026-03-19T10:30:00Z') and compare the result to the expected
string assembled using Intl.DateTimeFormat('ko-KR', { year:'numeric',
month:'numeric', day:'numeric', hour:'numeric', minute:'numeric' }) or to the
known expected literal (e.g., "2026년 3월 19일 ...") so the assertion checks exact
date parts for the ko-KR locale rather than loose contains checks; update the
test case in calendarSyncUtils.test.ts that references formatDateText
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 18f8f1d0-a5ec-4f29-b593-e16a43a64fa7

📥 Commits

Reviewing files that changed from the base of the PR and between 5527141 and 0a7dac5.

📒 Files selected for processing (1)
  • frontend/src/utils/calendarSyncUtils.test.ts

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.

1 participant