Skip to content

Commit c028c8e

Browse files
committed
Test Enable CoD Payment Gateway ViewModel
1 parent 60f107a commit c028c8e

File tree

6 files changed

+150
-20
lines changed

6 files changed

+150
-20
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/InPersonPaymentsViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct InPersonPaymentsView: View {
7777
case .stripeAccountRejected:
7878
InPersonPaymentsStripeRejected()
7979
case .codPaymentGatewayNotSetUp:
80-
InPersonPaymentsCodPaymentGatewayNotSetUp(viewModel: viewModel.codStepViewModel)
80+
InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp(viewModel: viewModel.codStepViewModel)
8181
case .completed:
8282
InPersonPaymentsCompleted()
8383
case .noConnectionError:

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/InPersonPaymentsViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ final class InPersonPaymentsViewModel: ObservableObject {
1010
private let useCase: CardPresentPaymentsOnboardingUseCase
1111
let stores: StoresManager
1212

13-
lazy var codStepViewModel: InPersonPaymentsCodPaymentGatewayNotSetUpViewModel = {
14-
InPersonPaymentsCodPaymentGatewayNotSetUpViewModel(completion: refresh)
13+
lazy var codStepViewModel: InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel = {
14+
InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel(completion: refresh)
1515
}()
1616

1717
/// Initializes the view model for a specific site

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsCodPaymentGatewayNotSetUp.swift renamed to WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import SwiftUI
22

3-
struct InPersonPaymentsCodPaymentGatewayNotSetUp: View {
4-
@ObservedObject var viewModel: InPersonPaymentsCodPaymentGatewayNotSetUpViewModel
3+
struct InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp: View {
4+
@ObservedObject var viewModel: InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel
55

66
var body: some View {
77
ScrollableVStack {
@@ -35,8 +35,8 @@ struct InPersonPaymentsCodPaymentGatewayNotSetUp: View {
3535

3636
struct InPersonPaymentsCodPaymentGatewayNotSetUp_Previews: PreviewProvider {
3737
static var previews: some View {
38-
let viewModel = InPersonPaymentsCodPaymentGatewayNotSetUpViewModel(completion: {})
39-
return InPersonPaymentsCodPaymentGatewayNotSetUp(viewModel: viewModel)
38+
let viewModel = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel(completion: {})
39+
return InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp(viewModel: viewModel)
4040
}
4141
}
4242

WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift renamed to WooCommerce/Classes/ViewRelated/Dashboard/Settings/In-Person Payments/Onboarding Errors/InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
import Foundation
22
import Yosemite
33

4-
class InPersonPaymentsCodPaymentGatewayNotSetUpViewModel: ObservableObject {
4+
class InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel: ObservableObject {
55
let completion: () -> ()
6-
private let stores: StoresManager = ServiceLocator.stores
6+
private let stores: StoresManager
7+
private let noticePresenter: NoticePresenter
78

89
@Published var awaitingResponse = false
910

1011
private var siteID: Int64? {
1112
stores.sessionManager.defaultStoreID
1213
}
1314

14-
init(completion: @escaping () -> ()) {
15+
init(stores: StoresManager = ServiceLocator.stores,
16+
noticePresenter: NoticePresenter = ServiceLocator.noticePresenter,
17+
completion: @escaping () -> ()) {
18+
self.stores = stores
19+
self.noticePresenter = noticePresenter
1520
self.completion = completion
1621
}
1722

@@ -40,7 +45,7 @@ class InPersonPaymentsCodPaymentGatewayNotSetUpViewModel: ObservableObject {
4045
self.displayEnableCashOnDeliveryFailureNotice()
4146
return
4247
}
43-
48+
4449
self.completion()
4550
}
4651
stores.dispatch(action)
@@ -63,7 +68,7 @@ class InPersonPaymentsCodPaymentGatewayNotSetUpViewModel: ObservableObject {
6368
actionTitle: Localization.cashOnDeliveryFailureNoticeRetryTitle,
6469
actionHandler: enableTapped)
6570

66-
ServiceLocator.noticePresenter.enqueue(notice: notice)
71+
noticePresenter.enqueue(notice: notice)
6772
}
6873
}
6974

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@
430430
02F843DA273646A30017FE12 /* JetpackBenefitsBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F843D9273646A30017FE12 /* JetpackBenefitsBanner.swift */; };
431431
02FE1B9F287F51F400EC03B3 /* LoginOnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FE1B9E287F51F400EC03B3 /* LoginOnboardingViewController.swift */; };
432432
02FE89C7231FAA4100E85EF8 /* MainTabBarControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02FE89C6231FAA4100E85EF8 /* MainTabBarControllerTests.swift */; };
433-
0313651128AB81B100EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0313651028AB81B100EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUp.swift */; };
433+
0313651128AB81B100EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0313651028AB81B100EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift */; };
434434
0313651328ABCB2D00EEE571 /* InPersonPaymentsOnboardingErrorMainContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0313651228ABCB2D00EEE571 /* InPersonPaymentsOnboardingErrorMainContentView.swift */; };
435-
0313651728ACE9F400EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0313651628ACE9F400EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift */; };
435+
0313651728ACE9F400EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0313651628ACE9F400EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift */; };
436436
031B10E3274FE2AE007390BA /* CardPresentModalConnectionFailedUpdateAddress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031B10E2274FE2AE007390BA /* CardPresentModalConnectionFailedUpdateAddress.swift */; };
437437
035C6DEB273EA12D00F70406 /* SoftwareUpdateTypeProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035C6DEA273EA12D00F70406 /* SoftwareUpdateTypeProperty.swift */; };
438438
035F2308275690970019E1B0 /* CardPresentModalConnectingFailedUpdatePostalCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 035F2307275690970019E1B0 /* CardPresentModalConnectingFailedUpdatePostalCode.swift */; };
@@ -449,6 +449,7 @@
449449
0386CFEB2852108B00134466 /* PaymentMethodsHostingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0386CFEA2852108B00134466 /* PaymentMethodsHostingController.swift */; };
450450
039D948D27610C6F0044EF38 /* UIView+SafeAreaConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039D948C27610C6F0044EF38 /* UIView+SafeAreaConstraints.swift */; };
451451
039D948F276113490044EF38 /* UIView+SuperviewConstraints.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039D948E276113490044EF38 /* UIView+SuperviewConstraints.swift */; };
452+
03A6C18428B52B1500AADF23 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A6C18328B52B1500AADF23 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests.swift */; };
452453
03AA165E2719B7EF005CCB7B /* ReceiptActionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03AA165D2719B7EF005CCB7B /* ReceiptActionCoordinator.swift */; };
453454
03AA16602719B83D005CCB7B /* ReceiptActionCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03AA165F2719B83D005CCB7B /* ReceiptActionCoordinatorTests.swift */; };
454455
03AFDE02282C0B82003B67CD /* InPersonPaymentsCompletedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03AFDE01282C0B82003B67CD /* InPersonPaymentsCompletedView.swift */; };
@@ -2265,9 +2266,9 @@
22652266
02F843D9273646A30017FE12 /* JetpackBenefitsBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackBenefitsBanner.swift; sourceTree = "<group>"; };
22662267
02FE1B9E287F51F400EC03B3 /* LoginOnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginOnboardingViewController.swift; sourceTree = "<group>"; };
22672268
02FE89C6231FAA4100E85EF8 /* MainTabBarControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarControllerTests.swift; sourceTree = "<group>"; };
2268-
0313651028AB81B100EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsCodPaymentGatewayNotSetUp.swift; sourceTree = "<group>"; };
2269+
0313651028AB81B100EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift; sourceTree = "<group>"; };
22692270
0313651228ABCB2D00EEE571 /* InPersonPaymentsOnboardingErrorMainContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsOnboardingErrorMainContentView.swift; sourceTree = "<group>"; };
2270-
0313651628ACE9F400EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift; sourceTree = "<group>"; };
2271+
0313651628ACE9F400EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift; sourceTree = "<group>"; };
22712272
03180BE52763AA8F00B938A8 /* Woo-Release-macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Woo-Release-macOS.entitlements"; sourceTree = "<group>"; };
22722273
03180BE62763AA8F00B938A8 /* Woo-Alpha-macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Woo-Alpha-macOS.entitlements"; sourceTree = "<group>"; };
22732274
03180BE72763AA9000B938A8 /* Woo-Debug-macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Woo-Debug-macOS.entitlements"; sourceTree = "<group>"; };
@@ -2287,6 +2288,7 @@
22872288
0386CFEA2852108B00134466 /* PaymentMethodsHostingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentMethodsHostingController.swift; sourceTree = "<group>"; };
22882289
039D948C27610C6F0044EF38 /* UIView+SafeAreaConstraints.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+SafeAreaConstraints.swift"; sourceTree = "<group>"; };
22892290
039D948E276113490044EF38 /* UIView+SuperviewConstraints.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+SuperviewConstraints.swift"; sourceTree = "<group>"; };
2291+
03A6C18328B52B1500AADF23 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests.swift; sourceTree = "<group>"; };
22902292
03AA165D2719B7EF005CCB7B /* ReceiptActionCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiptActionCoordinator.swift; sourceTree = "<group>"; };
22912293
03AA165F2719B83D005CCB7B /* ReceiptActionCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReceiptActionCoordinatorTests.swift; sourceTree = "<group>"; };
22922294
03AFDE01282C0B82003B67CD /* InPersonPaymentsCompletedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InPersonPaymentsCompletedView.swift; sourceTree = "<group>"; };
@@ -4723,6 +4725,22 @@
47234725
path = "Payment Methods";
47244726
sourceTree = "<group>";
47254727
};
4728+
03A6C18128B52ACC00AADF23 /* In-Person Payments */ = {
4729+
isa = PBXGroup;
4730+
children = (
4731+
03A6C18228B52ADB00AADF23 /* Onboarding Errors */,
4732+
);
4733+
path = "In-Person Payments";
4734+
sourceTree = "<group>";
4735+
};
4736+
03A6C18228B52ADB00AADF23 /* Onboarding Errors */ = {
4737+
isa = PBXGroup;
4738+
children = (
4739+
03A6C18328B52B1500AADF23 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests.swift */,
4740+
);
4741+
path = "Onboarding Errors";
4742+
sourceTree = "<group>";
4743+
};
47264744
03FBDA9B263AD47200ACE257 /* Coupons */ = {
47274745
isa = PBXGroup;
47284746
children = (
@@ -8217,15 +8235,16 @@
82178235
ABC35A4B736A0B2D8348DD08 /* InPersonPaymentsOnboardingError.swift */,
82188236
0313651228ABCB2D00EEE571 /* InPersonPaymentsOnboardingErrorMainContentView.swift */,
82198237
B979A9B9282D62A500EBB383 /* InPersonPaymentsDeactivateStripeView.swift */,
8220-
0313651028AB81B100EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUp.swift */,
8221-
0313651628ACE9F400EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift */,
8238+
0313651028AB81B100EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift */,
8239+
0313651628ACE9F400EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift */,
82228240
);
82238241
path = "Onboarding Errors";
82248242
sourceTree = "<group>";
82258243
};
82268244
E10DFC76267331450083AFF2 /* Settings */ = {
82278245
isa = PBXGroup;
82288246
children = (
8247+
03A6C18128B52ACC00AADF23 /* In-Person Payments */,
82298248
E10DFC77267331590083AFF2 /* ApplicationLogViewModelTests.swift */,
82308249
DEC51B03276B30F6009F3DF4 /* SystemStatusReportViewModelTests.swift */,
82318250
);
@@ -9509,7 +9528,7 @@
95099528
DE61978B28991F0E005E4362 /* WKWebView+Authenticated.swift in Sources */,
95109529
D8810086257DCCF0008DE6F2 /* WordPressComSiteInfo+Woo.swift in Sources */,
95119530
311237EE2714DA240033C44E /* CardPresentModalDisplayMessage.swift in Sources */,
9512-
0313651128AB81B100EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUp.swift in Sources */,
9531+
0313651128AB81B100EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUp.swift in Sources */,
95139532
45E3C8F325E7D30300102E84 /* ShippingLabelAddress+Woo.swift in Sources */,
95149533
57A25C7C25ACFAEC00A54A62 /* OrderFulfillmentNoticePresenter.swift in Sources */,
95159534
B9E4364C287587D300883CFA /* FeatureAnnouncementCardView.swift in Sources */,
@@ -9950,7 +9969,7 @@
99509969
4515C88D25D6BE540099C8E3 /* ShippingLabelAddressFormViewController.swift in Sources */,
99519970
CE5F462A23AACA0A006B1A5C /* RefundDetailsDataSource.swift in Sources */,
99529971
02162726237963AF000208D2 /* ProductFormViewController.swift in Sources */,
9953-
0313651728ACE9F400EEE571 /* InPersonPaymentsCodPaymentGatewayNotSetUpViewModel.swift in Sources */,
9972+
0313651728ACE9F400EEE571 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel.swift in Sources */,
99549973
571CDD5A250ACC470076B8CC /* UITableViewDiffableDataSource+Helpers.swift in Sources */,
99559974
4580BA7423F192D400B5F764 /* ProductSettingsViewController.swift in Sources */,
99569975
45977EBA2603F632006CDFB8 /* MapsHelper.swift in Sources */,
@@ -10365,6 +10384,7 @@
1036510384
DE3877E4283E35E80075D87E /* DiscountTypeBottomSheetListSelectorCommandTests.swift in Sources */,
1036610385
025678C725773399009D7E6C /* Collection+ShippingLabelTests.swift in Sources */,
1036710386
02BC5AA624D27F8900C43326 /* ProductVariationFormViewModel+ChangesTests.swift in Sources */,
10387+
03A6C18428B52B1500AADF23 /* InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests.swift in Sources */,
1036810388
DE279BAD26E9CBEA002BA963 /* ShippingLabelPackagesFormViewModelTests.swift in Sources */,
1036910389
57C2F6E624C27B3100131012 /* SwitchStoreNoticePresenterTests.swift in Sources */,
1037010390
020BE77123B4A4C6007FE54C /* AztecHorizontalRulerFormatBarCommandTests.swift in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import XCTest
2+
import TestKit
3+
4+
@testable import WooCommerce
5+
import Yosemite
6+
import Networking
7+
8+
final class InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModelTests: XCTestCase {
9+
10+
private var stores: MockStoresManager!
11+
12+
private var noticePresenter: MockNoticePresenter!
13+
14+
private var sut: InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel!
15+
16+
override func setUp() {
17+
stores = MockStoresManager(sessionManager: .testingInstance)
18+
stores.sessionManager.setStoreId(12345)
19+
noticePresenter = MockNoticePresenter()
20+
sut = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel(stores: stores, noticePresenter: noticePresenter, completion: {})
21+
}
22+
23+
func test_skip_always_calls_completion() {
24+
// Given
25+
let completionCalled: Bool = waitFor { promise in
26+
let sut = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel(stores: self.stores,
27+
noticePresenter: self.noticePresenter,
28+
completion: {
29+
promise(true)
30+
})
31+
32+
// When
33+
sut.skipTapped()
34+
}
35+
36+
// Then
37+
XCTAssert(completionCalled)
38+
}
39+
40+
func test_skip_saves_skipped_preference_for_the_current_site() {
41+
// Given
42+
var spySavedOnboardingSkipForSiteID: Int64? = nil
43+
stores.whenReceivingAction(ofType: AppSettingsAction.self) { action in
44+
switch action {
45+
case let .setSkippedCashOnDeliveryOnboardingStep(siteID):
46+
spySavedOnboardingSkipForSiteID = siteID
47+
default:
48+
break
49+
}
50+
}
51+
52+
// When
53+
sut.skipTapped()
54+
55+
// Then
56+
XCTAssertNotNil(spySavedOnboardingSkipForSiteID)
57+
assertEqual(12345, spySavedOnboardingSkipForSiteID)
58+
}
59+
60+
func test_enable_success_calls_completion() {
61+
// Given
62+
stores.whenReceivingAction(ofType: PaymentGatewayAction.self) { action in
63+
switch action {
64+
case let .updatePaymentGateway(paymentGateway, onCompletion):
65+
onCompletion(.success(paymentGateway))
66+
default:
67+
break
68+
}
69+
}
70+
71+
let completionCalled: Bool = waitFor { promise in
72+
let sut = InPersonPaymentsCashOnDeliveryPaymentGatewayNotSetUpViewModel(stores: self.stores,
73+
noticePresenter: self.noticePresenter,
74+
completion: {
75+
promise(true)
76+
})
77+
// When
78+
sut.enableTapped()
79+
}
80+
81+
// Then
82+
XCTAssert(completionCalled)
83+
}
84+
85+
func test_enable_failure_displays_notice() throws {
86+
// Given
87+
stores.whenReceivingAction(ofType: PaymentGatewayAction.self) { action in
88+
switch action {
89+
case let .updatePaymentGateway(_, onCompletion):
90+
onCompletion(.failure(DotcomError.noRestRoute))
91+
default:
92+
break
93+
}
94+
}
95+
96+
// When
97+
sut.enableTapped()
98+
99+
// Then
100+
let notice = try XCTUnwrap(noticePresenter.queuedNotices.first)
101+
let expectedTitle = "Failed to enable Pay in Person. Please try again later."
102+
assertEqual(expectedTitle, notice.title)
103+
}
104+
105+
}

0 commit comments

Comments
 (0)