Open
Conversation
4daeb94 to
30a7d56
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
⭐ 개요
MSW(Mock Service Worker)를 도입하여 프론트엔드 개발 단계에서 백엔드 API를 모킹할 수 있는 환경을 구축합니다. 이를 통해 API 개발 의존성을 줄이고 독립적인 UI 테스트를 가능하게 합니다.
📋 작업사항
package.json에msw라이브러리를 추가했습니다.start:msw스크립트를 추가하여 MSW가 활성화된 상태로 앱을 시작할 수 있도록 했습니다.proxy설정을 제거하고msw의 서비스 워커 디렉토리를 설정했습니다.src/index.js에REACT_APP_MSW환경 변수가 'enabled'일 때만 MSW를 활성화하는enableMocking함수를 추가했습니다.public폴더에 MSW 서비스 워커 파일(mockServiceWorker.js)을 추가했습니다.src/mocks/handlers.js에 애플리케이션에서 사용하는 모든 API(멤버, 기록, 영수증 등)에 대한 모의 응답 핸들러를 구현했습니다.src/mocks/browser.js에서 정의된 핸들러들을 사용하여 MSW 워커를 설정했습니다.ReactGA초기화 로직을 임시로 주석 처리했습니다.test.md파일을 추가했습니다.😉 참고사항
npm run start:msw명령어를 사용해주세요.src/mocks/handlers.js에 정의된 대로 모의 응답을 반환합니다.💻 스크린샷
Closes #{이슈 번호}
📝 리뷰 의견 (Review Feedback)
전반적으로 MSW(Mock Service Worker) 도입을 통해 프론트엔드 개발 환경이 개선된 것을 확인했습니다.
package.json업데이트,mockServiceWorker.js추가,src/index.js의 MSW 활성화 로직, 그리고src/mocks/handlers.js에 정의된 다양한 API 모킹 핸들러들을 통해 API 개발 의존성을 줄이고 독립적인 테스트가 가능해질 것으로 기대됩니다. 잘 작업해주셨습니다!몇 가지 개선점 및 질문 사항이 있습니다:
package.json-proxy설정 제거: 이 변경 사항이 PR 설명에 명확히 언급되어 있는지 확인해주세요. MSW 도입으로 인한 변경이라면 좋습니다.package.json-scripts블록 순서 변경: 기존 프로젝트 컨벤션과 일치하는지 확인해주시면 좋을 것 같습니다.src/index.js-ReactGA.initialize주석 처리: 프로덕션 빌드에서는 어떻게 처리될 예정인가요? MSW 활성화 여부에 따라 조건부로 처리하는 방안도 고려해볼 수 있습니다.src/mocks/handlers.js- 모의 응답 데이터: 현재 정적으로 설정되어 있습니다. 다양한 테스트 시나리오(예: 에러 응답, 빈 목록, 다른 사용자 역할)를 위해 좀 더 동적인 데이터나 여러 케이스를 고려해볼 수 있을까요?test.md파일: 새로 추가되었는데, 최종적으로 저장소에 유지될 예정인가요? 임시 파일이라면 PR에서 제거하는 것이 좋습니다.