Commit 7d41935
feat: 엔티티 비즈니스 로직 분리 및 테스트 커버리지 개선 (#7)
* config: MDX frontmatter 처리를 위한 remark 플러그인 추가
- remark-frontmatter: MDX frontmatter 파싱 지원
- remark-mdx-frontmatter: MDX 컴포넌트에서 frontmatter 사용 가능
- next.config.ts에 remarkPlugins 설정 추가
- package.json에 필요한 의존성 추가
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* refactor: API 레이어를 엔티티 기반 아키텍처로 변경
- src/entities/posts/ 엔티티 추가
- index.ts: 게시물 관련 비즈니스 로직
- types.ts: 게시물 타입 정의
- src/api/posts.ts 삭제하여 도메인 로직 분리
- 블로그 페이지에서 새로운 엔티티 import 경로 적용
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* docs: 테스트 MDX 파일들에 frontmatter 추가
* docs: Claude Code 아키텍처 가이드 확장
- 도메인 엔티티 기반 아키텍처
- 컨텐츠 관리 섹션 수정
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* config: Vitest 테스트 환경 및 커버리지 도구 설정
- Vitest 테스트 프레임워크 추가
- @vitest/ui 및 @vitest/coverage-v8 커버리지 도구 설정
- 엔티티 테스트를 위한 테스트 스크립트 추가
- src/entities/** 파일 커버리지 타겟 설정
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* test: Posts 엔티티 테스트 구현
- getAllPosts, getPostBySlug, getPostsByTag 함수 테스트
- 파일 시스템 mocking 및 gray-matter 파싱 테스트
- 에러 처리 및 엣지 케이스 테스트 포함
- 빈 디렉토리, 잘못된 날짜 형식 등 예외 상황 검증
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* test: Tags 엔티티 그래프 기반 테스트 구현
- getAllTags, getTagByName, getTagGraph, getTagRelationships 함수 테스트
- graphology 기반 그래프 구조 검증
- 태그 공동 출현 분석 및 관계 계산 테스트
- 클러스터링 알고리즘 및 중심성 계산 테스트
- 통계 분석 및 에지 케이스 검증 포함
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* test: 통합 테스트 및 타입 검증 테스트 추가
- Posts와 Tags 엔티티 간의 통합 테스트 구현
- 실제 블로그 데이터 시뮬레이션 시나리오 테스트
- 타입 인터페이스 구조 검증 테스트
- 테스트 환경 설정 파일 추가
- 엔티티 간 상호작용 및 데이터 흐름 검증
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat: graphology 기반 태그 엔티티 구현 및 타입 정의
- graphology 라이브러리를 이용한 태그 그래프 구조 구현
- 태그 공동 출현 관계 분석 및 유사도 계산
- 중심성 기반 태그 클러스터링 알고리즘
- 태그 통계 분석 기능 (most used, least used, average)
- TypeScript 타입 정의 및 인터페이스 구현
- UndirectedGraph 타입을 활용한 태그 그래프 정의
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* chore: 개발 환경 설정 업데이트
- 프로젝트 VSCode 설정에서 eslint 동작 방지
- CLAUDE.md에 개발 중 불필요한 개벌서버 실행 방지 지침 추가
- types.ts 파일 테스트 방지
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: 테스트 코드 타입 안정성 개선 및 불필요한 타입 테스트 제거
* ci: CI 설정에서 빌드 단계 제거 및 테스트 실행 단계 추가
* refactor: 엔티티 비즈니스 로직을 별도 파일로 분리
- Posts 엔티티 로직 분리 및 테스트 개선
- parsePostData, sortPostsByDate, filterPostsByTag, filterMdxFiles 함수 추출
- 외부 의존성 없는 순수 함수로 분리하여 테스트 용이성 향상
- PostGrayMatter 타입 정의 개선
- Tags 엔티티 로직 분리 및 테스트 완성
- extractTagsFromPosts, createTagGraph, analyzeTagRelationships 등 모든 로직 분리
- 100% 테스트 커버리지 달성 (22개 테스트 케이스)
- undefined tags 처리, 강한/약한 관계 임계값 등 edge case 테스트 추가
- 통합 테스트 파일 제거
- 기존 entities.integration.test.ts 제거
- 각 엔티티별 독립적인 단위 테스트로 전환
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* remove: 통합 테스트 파일 제거
- entities.integration.test.ts 삭제
- 각 엔티티별 독립적인 단위 테스트로 대체됨
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent f5ad3b1 commit 7d41935
File tree
20 files changed
+2891
-57
lines changed- .github/workflows
- .vscode
- src
- api
- app/blog/[slug]
- contents
- entities
- posts
- tags
- test
20 files changed
+2891
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 35 | + | |
| 36 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
176 | 189 | | |
177 | 190 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
182 | 196 | | |
183 | 197 | | |
184 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| 45 | + | |
| 46 | + | |
37 | 47 | | |
38 | 48 | | |
39 | 49 | | |
40 | | - | |
| 50 | + | |
| 51 | + | |
41 | 52 | | |
42 | 53 | | |
43 | 54 | | |
0 commit comments