Skip to content

Commit

Permalink
Improve TimetableDetailTests
Browse files Browse the repository at this point in the history
Modify to correctly assert error reception
  • Loading branch information
yimajo committed Sep 5, 2024
1 parent 40dfa40 commit 60db87a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ final class TimetableDetail_iosTests: XCTestCase {

// add favorite
await store.send(.view(.favoriteButtonTapped))
await store.receive(\.favoriteResponse) {
await store.receive(\.favoriteResponse.success) {
$0.isFavorited = !isFavorited
$0.toast = .init(text: String(localized: "TimetableDetailAddBookmark", bundle: .module))
}

// remove favorite
await store.send(.view(.favoriteButtonTapped))
await store.receive(\.favoriteResponse) {
await store.receive(\.favoriteResponse.success) {
$0.isFavorited = isFavorited
}

Expand All @@ -36,7 +36,7 @@ final class TimetableDetail_iosTests: XCTestCase {
}

await store.send(.view(.favoriteButtonTapped))
await store.receive(\.favoriteResponse)
await store.receive(\.favoriteResponse.failure)
}

@MainActor func testTappedURL() async throws {
Expand All @@ -58,7 +58,7 @@ final class TimetableDetail_iosTests: XCTestCase {
}

await store.send(.view(.calendarButtonTapped))
await store.receive(\.requestEventAccessResponse) {
await store.receive(\.requestEventAccessResponse.success) {
$0.confirmationDialog = ConfirmationDialogState(title: {
TextState("")
}, actions: {
Expand All @@ -71,7 +71,7 @@ final class TimetableDetail_iosTests: XCTestCase {
await store.send(.confirmationDialog(.presented(.addEvent))) {
$0.confirmationDialog = nil
}
await store.receive(\.addEventResponse)
await store.receive(\.addEventResponse.success)
}

@MainActor func testTappedVideoButton() async throws {
Expand Down

0 comments on commit 60db87a

Please sign in to comment.