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

QuestUseCase 작성 및 테스트 #30

Merged
merged 8 commits into from
Nov 22, 2022
Merged

Conversation

jinwoong16
Copy link
Collaborator

📕 Issue Number

Close #28

📙 작업 내역

구현 내용 및 작업 했던 내역

  • QuestUseCase 프로토콜 작성
  • DefaultQuestUseCase 구현
  • Quest를 fetch해오는 액션 추가
  • Quest fetch 테스트
  • Quest Add 액션
  • Quest Add 테스트

📘 작업 유형

  • 신규 기능 추가
  • 버그 수정
  • 리펙토링
  • 문서 업데이트

📋 체크리스트

  • Merge 하는 브랜치가 올바른가?
  • 코딩컨벤션을 준수하는가?
  • PR과 관련없는 변경사항이 없는가?
  • 내 코드에 대한 자기 검토가 되었는가?
  • 변경사항이 효과적이거나 동작이 작동한다는 것을 보증하는 테스트를 추가하였는가?
  • 새로운 테스트와 기존의 테스트가 변경사항에 대해 만족하는가?

📝 PR 특이 사항

PR을 볼 때 주의깊게 봐야하거나 말하고 싶은 점

  • QuestUseCase의 테스트 코드를 추가하여 진행하였습니다. 테스트는 Repository Mock 을 만들고, fetch 메서드가 정상적으로 Quest의 배열을 보내는 상황을 테스트 하였습니다. 정상적인 경우라면, Quest UseCase의 fetch 메서드를 실행하면, Quest의 배열을 방출하는 Observable을 반환할 것입니다.
func testQuestUseCase_WhenRepoSendCorrectQuests_ThenExpectationWillBeFulfilledWithSuccess() {
    // given
    questRepo = QuestRepositoryMock()
    
    questUseCase = DefaultQuestUseCase(questsRepository: questRepo)
    
    let expectation = XCTestExpectation(description: "test success")
    
    // when
    questUseCase
        .fetch(by: Date())
    // then
        .subscribe(onNext: { data in
            expectation.fulfill()
        }, onError: { _ in
            XCTFail("test failed")
        })
        .disposed(by: disposeBag)
    
    wait(for: [expectation], timeout: 1)
}

Screenshot 2022-11-21 at 4 47 56 PM

  • Quest를 추가하는 로직은 추가하지 않았습니다. Quest를 추가하는 뷰가 아직 없어서 구현 이후에 확장시키면 될 것 같아요.
  • 기존에 가짜데이터로 처리되던 View와 ViewModel은 비활성화 하였습니다. Repo구현이 완료되면 연동 후, DB에 실제 데이터를 넣고 동작을 확인하면 될 것 같아요.



@jinwoong16 jinwoong16 linked an issue Nov 21, 2022 that may be closed by this pull request
2 tasks
startDay: quest.startDay,
endDay: quest.endDay,
startDay: Date(), // no more use
endDay: Date(), // no more use
Copy link
Member

Choose a reason for hiding this comment

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

quest Entity도 수정해 놓겠습니다

Copy link
Member

Choose a reason for hiding this comment

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

  • Quest에 Date 추가해야 할 것 같습니다!

import Foundation

extension Quest {
static func stub(groupId: UUID,
Copy link
Member

Choose a reason for hiding this comment

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

stub의 목적이 무엇인지 내일 조금 설명해주시면 좋을 것 같아요

@Jeonhui
Copy link
Member

Jeonhui commented Nov 21, 2022

오늘도 고생 많으셨습니다!🙃

@sprituz
Copy link
Member

sprituz commented Nov 21, 2022

고생많으셨읍니다

@wickedRun
Copy link
Collaborator

고생하셨습니다!!
하나 궁금한게 Use Case가 이런 식이라면 뷰모델이 여러개 Use Case를 갖는 걸까요?

@jinwoong16 jinwoong16 merged commit ce81602 into develop Nov 22, 2022
@jinwoong16 jinwoong16 deleted the feature/QuestUseCase branch November 22, 2022 01:38
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.

Quest Use Case
4 participants