Skip to content

Commit 19cb3da

Browse files
committed
StorePickerCoordinator: add two test cases for standard and switchingStores configurations.
1 parent d0a5f30 commit 19cb3da

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

WooCommerce/WooCommerceTests/Authentication/StorePickerCoordinatorTests.swift

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,38 @@ final class StorePickerCoordinatorTests: XCTestCase {
4242
let storeCreationNavigationController = try XCTUnwrap(navigationController.presentedViewController as? UINavigationController)
4343
assertThat(storeCreationNavigationController.topViewController, isAnInstanceOf: AuthenticatedWebViewController.self)
4444
}
45+
46+
func test_standard_configuration_presents_storePicker() throws {
47+
// Given
48+
let coordinator = StorePickerCoordinator(navigationController, config: .standard)
49+
50+
// When
51+
coordinator.start()
52+
53+
// Then
54+
waitUntil {
55+
self.navigationController.presentedViewController is WooNavigationController
56+
}
57+
XCTAssertNil(navigationController.topViewController)
58+
59+
let storePickerNavigationController = try XCTUnwrap(navigationController.presentedViewController as? UINavigationController)
60+
assertThat(storePickerNavigationController.topViewController, isAnInstanceOf: StorePickerViewController.self)
61+
}
62+
63+
func test_switchingStores_configuration_presents_storePicker() throws {
64+
// Given
65+
let coordinator = StorePickerCoordinator(navigationController, config: .switchingStores)
66+
67+
// When
68+
coordinator.start()
69+
70+
// Then
71+
waitUntil {
72+
self.navigationController.presentedViewController is WooNavigationController
73+
}
74+
XCTAssertNil(navigationController.topViewController)
75+
76+
let storePickerNavigationController = try XCTUnwrap(navigationController.presentedViewController as? UINavigationController)
77+
assertThat(storePickerNavigationController.topViewController, isAnInstanceOf: StorePickerViewController.self)
78+
}
4579
}

0 commit comments

Comments
 (0)