Skip to content

[Koin Project][Chore] 일부 Usecase에 대한 테스트 작성#1261

Merged
kongwoojin merged 8 commits intodevelopfrom
chore/#1260-add-usecase-test
Feb 22, 2026
Merged

[Koin Project][Chore] 일부 Usecase에 대한 테스트 작성#1261
kongwoojin merged 8 commits intodevelopfrom
chore/#1260-add-usecase-test

Conversation

@kongwoojin
Copy link
Copy Markdown
Member

PR 개요

PR 체크리스트

  • Code convention을 잘 지켰나요?
  • Lint check를 수행하였나요?
  • Assignees를 추가했나요?

작업사항

  • 버그 수정
  • 신규 기능
  • 코드 스타일 수정 (포맷팅 등)
  • 리팩토링 (기능 수정 X, API 수정 X)
  • 기타

작업사항의 상세한 설명

  • domain 모듈에 Junit4, coroutine test dependencies를 추가했습니다.
  • AGENTS.md의 잘못된 지시문을 수정했습니다.
  • UserLoginUseCase, VerifyPasswordFormatUseCase 그리고 GetNearbyShopUseCase에 대한 테스트 코드를 작성했습니다.
VerifyPasswordFormatUseCase UserLoginUseCase GetNearbyShopUseCase
단순 검증 로직이기 때문에, 단순한 테스트 코드입니다. 로그인 로직이라 테스트가 필요하다고 생각했는데, 클라에서 하는 검증 로직도 거의 없고 mock data를 많이 필요하기 때문에 추후 mock data 추가와 함께 추가 테스트 작성이 필요합니다. UseCase에서 필터링 및 정렬 로직을 수행하기 때문에 해당 로직을 검증하는 테스트 코드를 작성했습니다.

논의 사항

  • Junit 4를 쓰고 있길래 그대로 썼는데, 업데이트가 필요할 수도 있겠네요

스크린샷

추가내용

  • develop, sprint 브랜치를 향하고 있습니다
  • production 브랜치를 향하고 있습니다

@kongwoojin kongwoojin self-assigned this Feb 7, 2026
@kongwoojin kongwoojin requested a review from a team as a code owner February 7, 2026 17:43
Copy link
Copy Markdown
Collaborator

@KYM-P KYM-P left a comment

Choose a reason for hiding this comment

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

좋은 것 같습니다!
다만 좋은 test 는 여러가지 경우에서도 잘 동작하는지 검증하는 test 이므로
여러 case 들을 넣어 검증하면 더 좋을 거 같습니다.


Assert.assertNull(result.first)
Assert.assertNotNull(result.second)
Assert.assertFalse(result.second!!.isSuccess)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

second가 UserErrorHandler 인 경우의 타입 비교 검증은 필요 없으려나요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

second가 UserErrorHandler가 아닐 수는 없어서 별도의 검증은 필요하지 않을 것 같습니다.

fun `비밀번호에 영어가 포함되었는가`() {
val password = "password"
val result = VerifyPasswordFormatUseCase().invoke(password)
assertTrue(result.isIncludeEnglish)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

영어가 아닌 case 의 경우 false 를 반환하는 검증도 있으면 좋을 거 같아요

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

전부 수정했습니다.

fun `비밀번호에 숫자가 포함되었는가`() {
val password = "password123"
val result = VerifyPasswordFormatUseCase().invoke(password)
assertTrue(result.isIncludeNumber)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

요것도 false 가 나오는 case 도 있으면 좋을 거 같아요

fun `비밀번호에 기호가 포함되었는가`() {
val password = "password!"
val result = VerifyPasswordFormatUseCase().invoke(password)
assertTrue(result.isIncludeSymbol)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

요것도 false

fun `비밀번호 길이가 6에서 18자가 아닐 경우`() {
val password = "pass"
val result = VerifyPasswordFormatUseCase().invoke(password)
assertFalse(result.isValidLength)
Copy link
Copy Markdown
Collaborator

@KYM-P KYM-P Feb 8, 2026

Choose a reason for hiding this comment

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

이것도 true 의 case 도 만들면 좋겠네요
또한 경계값인 6자, 18 자 부분의 테스트도 넣으면 좋을 듯 합니다.
이상, 이하의 코딩이 잘못 되었을 수도 있으니까요

@kongwoojin kongwoojin requested a review from KYM-P February 9, 2026 17:27
@kongwoojin kongwoojin linked an issue Feb 16, 2026 that may be closed by this pull request
@kongwoojin kongwoojin merged commit 756f74a into develop Feb 22, 2026
1 check passed
@kongwoojin kongwoojin deleted the chore/#1260-add-usecase-test branch February 22, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Koin Project] Usecase 테스트 코드 작성

2 participants