Skip to content

Commit

Permalink
use Result instead of TaskResult
Browse files Browse the repository at this point in the history
  • Loading branch information
ski-u committed Sep 28, 2024
1 parent 7abbf20 commit a003763
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Features/Sources/Today/TodayReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public struct TodayReducer: Sendable {
}
}

public enum Action: Equatable {
public enum Action {
case fetch
case response(TaskResult<AstronomyPicture>)
case response(Result<AstronomyPicture, any Error>)
}

public init() {}
Expand All @@ -41,7 +41,7 @@ public struct TodayReducer: Sendable {
return .run { send in
await send(
.response(
TaskResult {
Result {
try await client.apod()
}
)
Expand Down
4 changes: 2 additions & 2 deletions Features/Tests/TodayTests/TodayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class TodayTests: XCTestCase {
$0.isLoading = true
}

await store.receive(.response(.success(mock))) {
await store.receive(\.response.success) {
$0.isLoading = false
$0.picture = mock
}
Expand All @@ -41,7 +41,7 @@ final class TodayTests: XCTestCase {
$0.isLoading = true
}

await store.receive(.response(.failure(error))) {
await store.receive(\.response.failure) {
$0.error = .init(error.localizedDescription)
$0.isLoading = false
}
Expand Down

0 comments on commit a003763

Please sign in to comment.