Skip to content

Commit ddc6264

Browse files
committed
Rename CreateCartError.noMatchingProduct to CreateCartError.productNotInCart to match the scenario more.
1 parent fde4554 commit ddc6264

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Networking/Networking/Remote/PaymentRemote.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class PaymentRemote: Remote, PaymentRemoteProtocol {
4444
let request = DotcomRequest(wordpressApiVersion: .mark1_1, method: .post, path: path, parameters: parameters)
4545
let response: CreateCartResponse = try await enqueue(request)
4646
guard response.products.contains(where: { $0.productID == productID }) else {
47-
throw CreateCartError.noMatchingProduct
47+
throw CreateCartError.productNotInCart
4848
}
4949
}
5050
}
@@ -69,7 +69,7 @@ public enum LoadPlanError: Error {
6969

7070
/// Possible error cases from creating cart for a site with a WPCOM plan.
7171
public enum CreateCartError: Error {
72-
case noMatchingProduct
72+
case productNotInCart
7373
}
7474

7575
/// Contains necessary data for handling the remote response from creating a cart.

Networking/NetworkingTests/Remote/PaymentRemoteTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ final class PaymentRemoteTests: XCTestCase {
7676
}
7777
}
7878

79-
func test_createCart_throws_noMatchingProduct_error_when_response_does_not_include_plan_with_given_id() async throws {
79+
func test_createCart_throws_productNotInCart_error_when_response_does_not_include_plan_with_given_id() async throws {
8080
// Given
8181
let siteID: Int64 = 606
8282
let remote = PaymentRemote(network: network)
@@ -87,7 +87,7 @@ final class PaymentRemoteTests: XCTestCase {
8787
_ = try await remote.createCart(siteID: siteID, productID: 685)
8888
} errorAssert: { error in
8989
// Then
90-
(error as? CreateCartError) == .noMatchingProduct
90+
(error as? CreateCartError) == .productNotInCart
9191
}
9292
}
9393

0 commit comments

Comments
 (0)