Skip to content

Commit

Permalink
Code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Apr 12, 2022
1 parent 7bdd49b commit e570b81
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,9 @@ class BackendGetCustomerInfoTests: BaseBackendTests {

expect(result).toEventuallyNot(beNil())

switch result {
case .failure(.networkError(.decoding)):
// Correct result
break

default:
guard case .failure(.networkError(.decoding)) = result else {
fail("Unexpected result: \(result!)")
return
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,10 @@ class BackendPostOfferForSigningTests: BaseBackendTests {
}

expect(receivedError).toEventuallyNot(beNil())
switch receivedError {
case .unexpectedBackendResponse(.postOfferIdSignature, _, _):
// Correct error
break

default:
guard case .unexpectedBackendResponse(.postOfferIdSignature, _, _) = receivedError else {
fail("Invalid error: \(String(describing: receivedError))")
return
}
}

Expand Down
1 change: 1 addition & 0 deletions Tests/UnitTests/Networking/NetworkErrorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class NetworkErrorTests: XCTestCase {

// MARK: - Helpers

/// Stores the file/line information so expectation failures can point to the line creating the error.
private func error(
_ error: NetworkError,
file: FileString = #file, line: UInt = #line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ class BackendSubscriberAttributesTestBase: XCTestCase {
expect(receivedResult).to(beFailure())

let error = try XCTUnwrap(receivedResult?.error)
switch error {
case .networkError(.decoding):
break // expected error
default:
guard case .networkError(.decoding) = error else {
fail("Unexpected error: \(error)")
return
}
}

Expand Down

0 comments on commit e570b81

Please sign in to comment.