Skip to content

Commit

Permalink
✅ :: [#122] DetailNoticeFeature / 공지 선택 및 해제 액션 Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Jul 29, 2023
1 parent efba3ba commit e961e8f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Projects/Feature/NoticeFeature/Tests/NoticeFeatureTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ final class NoticeFeatureTests: XCTestCase {
XCTAssertEqual(sut.currentState.isEditingMode, true)
}

func test_RouteNoticeDetail_When_NoticeDidTap_And_IsEditingFalse() {
func test_RouteNoticeDetail_When_NoticeDidSelect_And_IsEditingFalse() {
let expectedNoticeID = 1
XCTAssertEqual(sut.currentState.isEditingMode, false)
let expectation = XCTestExpectation(description: "route expectation")
Expand All @@ -110,38 +110,38 @@ final class NoticeFeatureTests: XCTestCase {
}
.store(in: &subscription)

sut.send(.noticeDidTap(expectedNoticeID))
sut.send(.noticeDidSelect(expectedNoticeID))

wait(for: [expectation], timeout: 1.0)
guard
let latestRoutePath = latestRoutePath?.asDotori,
case let .noticeDetail(noticeID) = latestRoutePath,
case let .detailNotice(noticeID) = latestRoutePath,
noticeID == expectedNoticeID
else {
XCTFail("latestRoutePath is not DotoriRoutePath.noticeDetail")
return
}
}

func test_InsertSelectedNotice_When_NoticeDidTap_And_IsEditingTrue() {
func test_InsertSelectedNotice_When_NoticeDidSelectAndDeselect_And_IsEditingTrue() {
sut.send(.editButtonDidTap)
XCTAssertEqual(sut.currentState.isEditingMode, true)

let noticeIDOne = 1
sut.send(.noticeDidTap(noticeIDOne))
sut.send(.noticeDidSelect(noticeIDOne))

XCTAssertEqual([noticeIDOne], sut.currentState.selectedNotice)

let noticeIDTwo = 2
sut.send(.noticeDidTap(noticeIDTwo))
sut.send(.noticeDidSelect(noticeIDTwo))
XCTAssertEqual([noticeIDOne, noticeIDTwo], sut.currentState.selectedNotice)

sut.send(.noticeDidTap(noticeIDOne))
XCTAssertEqual([noticeIDTwo], sut.currentState.selectedNotice)

sut.send(.noticeDidTap(noticeIDOne))
sut.send(.noticeDidSelect(noticeIDOne))
XCTAssertEqual([noticeIDOne, noticeIDTwo], sut.currentState.selectedNotice)

sut.send(.noticeDidDeselect(noticeIDOne))
XCTAssertEqual([noticeIDTwo], sut.currentState.selectedNotice)

sut.send(.editButtonDidTap)
XCTAssertEqual([], sut.currentState.selectedNotice)
}
Expand Down

0 comments on commit e961e8f

Please sign in to comment.