[Fix-143] FE 코드/프로젝트 컨벤션 체크 테스트 추가#37
Conversation
📝 WalkthroughWalkthroughA new Jest unit test file is added that validates frontend project structure and architectural conventions, including required directories, colocated test patterns, and specific code ownership rules across the source tree. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: ed6c424a-3d3d-4500-8ddd-55d50f7850f9
📒 Files selected for processing (1)
tests/unit/architecture/web-structure-convention.test.ts
📜 Review details
🔇 Additional comments (2)
tests/unit/architecture/web-structure-convention.test.ts (2)
30-42: Good defensive file traversal for convention checks.
collectFileshandles missing directories safely and keeps traversal deterministic for the subsequent assertions.
1-4: No action needed. Vitest globals are explicitly enabled invite.config.ts(globals: true), sodescribe,it, andexpectwork without explicit imports in this test file. The original concern aboutReferenceErrordoes not apply.> Likely an incorrect or invalid review comment.
| const loaderOwners = scanSourceFiles( | ||
| (_, source) => | ||
| /\bcreateBrowserRouter\s*\(/.test(source) | ||
| || /\buseLoaderData\s*\(/.test(source) | ||
| || /\bloader\s*:/.test(source), | ||
| ); |
There was a problem hiding this comment.
Narrow the loader: detector to avoid false positives.
The \bloader\s*: pattern matches any loader property, not just React Router data-loader usage. This can fail on unrelated domain code and make the convention test brittle.
Proposed fix
it('keeps route-level data loading off React Router loaders', () => {
const loaderOwners = scanSourceFiles(
(_, source) =>
/\bcreateBrowserRouter\s*\(/.test(source)
|| /\buseLoaderData\s*\(/.test(source)
- || /\bloader\s*:/.test(source),
+ || (
+ /\bcreate(Browser|Hash|Memory)Router\s*\(/.test(source)
+ && /\bloader\s*:\s*(async\s*)?\(/.test(source)
+ ),
);
expect(loaderOwners).toEqual([]);
});📝 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 loaderOwners = scanSourceFiles( | |
| (_, source) => | |
| /\bcreateBrowserRouter\s*\(/.test(source) | |
| || /\buseLoaderData\s*\(/.test(source) | |
| || /\bloader\s*:/.test(source), | |
| ); | |
| const loaderOwners = scanSourceFiles( | |
| (_, source) => | |
| /\bcreateBrowserRouter\s*\(/.test(source) | |
| || /\buseLoaderData\s*\(/.test(source) | |
| || ( | |
| /\bcreate(Browser|Hash|Memory)Router\s*\(/.test(source) | |
| && /\bloader\s*:\s*(async\s*)?\(/.test(source) | |
| ), | |
| ); |
목적
FE가 현재 합의된 구조 컨벤션을 계속 유지할 수 있도록, 실제 구조를 기준으로 자동 검증을 추가했습니다.
이번 변경은 기능 리팩터보다는 api-hook-component-page 경계와 구조 규칙을 회귀 없이 지키도록 만드는 데 목적이 있습니다.
변경 요약
EventSource소유 위치, router loader 미사용,axios.create중앙화,src/하위 테스트 금지 규칙을 테스트로 고정했습니다.관련 이슈
Closes #
Related: #
리뷰 포인트
api -> hook/controller -> component -> page흐름을 테스트가 과하게 제한하지 않는지 확인 부탁드립니다.테스트 결과
로컬 테스트 통과
CI 통과
수동 검증 완료
Draft PR 전용 체크리스트
현재 피드백 받고 싶은 범위를 명확히 작성했습니다.
머지 전 남은 작업(TODO)을 정리했습니다.
완료되지 않은 항목/리스크를 본문에 명시했습니다.
일반 PR 전용 체크리스트
self-review를 완료했습니다.
머지 전 필수 작업이 모두 완료되었습니다.
필요한 문서(README/API/주석)를 업데이트했습니다.
브레이킹 체인지 여부를 확인했고 필요 시 명시했습니다.