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

Improve usage of store.receive in multiple tests #975

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class ContributorFeatureTests: XCTestCase {
}

await store.send(.onAppear)
await store.receive(\.response) {
await store.receive(\.response.success) {
$0.contributors = [
.init(id: 0, userName: "hoge", profileUrl: URL(string: "https://2024.droidkaigi.jp/"), iconUrl: URL(string: "https://avatars.githubusercontent.com/u/10727543?s=200&v=4")!),
.init(id: 0, userName: "fuga", profileUrl: nil, iconUrl: URL(string: "https://avatars.githubusercontent.com/u/10727543?s=200&v=4")!),
Expand All @@ -47,7 +47,7 @@ final class ContributorFeatureTests: XCTestCase {
}

await store.send(.onAppear)
await store.receive(\.response)
await store.receive(\.response.failure)
}

@MainActor
Expand Down
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
Loading