Skip to content

Commit

Permalink
Sync NetworkServiceMock
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsprint09 committed Feb 7, 2024
1 parent 3bd1831 commit 485dafc
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions Source/NetworkServices/NetworkServiceMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@ import Foundation
*/
public final class NetworkServiceMock: NetworkService, @unchecked Sendable {

public enum Error: Swift.Error, CustomDebugStringConvertible {
case missingRequest
case typeMismatch

public var debugDescription: String {
switch self {
case .missingRequest:
return "Could not return because no request"
case .typeMismatch:
return "Return type does not match requested type"
}
}
}

/// Count of all started requests
public var requestCount: Int {
return lastRequests.count
Expand Down Expand Up @@ -147,6 +133,7 @@ public final class NetworkServiceMock: NetworkService, @unchecked Sendable {
- parameter onError: Callback which gets called when fetching or transforming fails.

*/
@MainActor
public func requestResultWithResponse<Success>(for resource: Resource<Success, NetworkError>) async -> Result<(Success, HTTPURLResponse), NetworkError> {
lastRequests.append(resource.request)
if !responses.isEmpty {
Expand Down

0 comments on commit 485dafc

Please sign in to comment.