Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: 클래스 커스텀훅 테스트 코드 #274

Merged
merged 4 commits into from
Dec 3, 2024
Merged

Conversation

PHJoon
Copy link
Contributor

@PHJoon PHJoon commented Dec 2, 2024

📝 개요

클래스 커스텀훅 테스트 코드

🚀 변경사항

  • 클래스 커스텀훅 테스트 코드
  • useSubClassFileHandler에서 에러 메시지 부분 수정했습니다.

🔗 관련 이슈

#231

➕ 기타

@PHJoon PHJoon added test 테스트 관련 fix 텍스트, 오타 수정 등 labels Dec 2, 2024
@PHJoon PHJoon requested a review from imdaxsz December 2, 2024 10:26
@PHJoon PHJoon self-assigned this Dec 2, 2024

// mocking useParams
const mockUseParams = (classId?: string, subClassId?: string) => {
vi.doMock('react-router-dom', () => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

doMock이라는 것도 있었네요. 배워갑니다!!

Comment on lines +6 to +10
const setUser = (role: string | undefined) => {
vi.doMock('@/stores', () => ({
default: () => ({ role }),
}));
};
Copy link
Contributor

Choose a reason for hiding this comment

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

오오.. 저는 지금 로컬에 store를 그냥 테스트에 직접 가져와서 mock data 넣고, 접근하는 방식의 코드로 커밋했는데 이게 훨씬 좋아 보이네요 👍👍

Copy link
Contributor

@imdaxsz imdaxsz left a comment

Choose a reason for hiding this comment

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

테스트 케이스가 엄청 많네요 수고하셨습니다! 테스트 코드 공부가 끝이 없네요......

@PHJoon PHJoon merged commit b9102c1 into develop Dec 3, 2024
2 checks passed
@PHJoon PHJoon deleted the test/class-test/phj branch December 3, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 텍스트, 오타 수정 등 test 테스트 관련
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants