Skip to content

Commit ab8bf03

Browse files
committed
Add a test case for LoggedOutStoreCreationCoordinator.
1 parent 78db231 commit ab8bf03

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
020BE77723B4A9D9007FE54C /* AztecLinkFormatBarCommandTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020BE77623B4A9D9007FE54C /* AztecLinkFormatBarCommandTests.swift */; };
4848
020C908424C84652001E2BEB /* ProductListMultiSelectorSearchUICommandTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020C908324C84652001E2BEB /* ProductListMultiSelectorSearchUICommandTests.swift */; };
4949
020D0BFD2914E92800BB3DCE /* StorePickerCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020D0BFC2914E92800BB3DCE /* StorePickerCoordinatorTests.swift */; };
50+
020D0BFF2914F6BA00BB3DCE /* LoggedOutStoreCreationCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020D0BFE2914F6BA00BB3DCE /* LoggedOutStoreCreationCoordinatorTests.swift */; };
5051
020DD48A23229495005822B1 /* ProductsTabProductTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020DD48923229495005822B1 /* ProductsTabProductTableViewCell.swift */; };
5152
020DD48D2322A617005822B1 /* ProductsTabProductViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020DD48C2322A617005822B1 /* ProductsTabProductViewModel.swift */; };
5253
020DD48F232392C9005822B1 /* UIViewController+AppReview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020DD48E232392C9005822B1 /* UIViewController+AppReview.swift */; };
@@ -2001,6 +2002,7 @@
20012002
020BE77623B4A9D9007FE54C /* AztecLinkFormatBarCommandTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AztecLinkFormatBarCommandTests.swift; sourceTree = "<group>"; };
20022003
020C908324C84652001E2BEB /* ProductListMultiSelectorSearchUICommandTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductListMultiSelectorSearchUICommandTests.swift; sourceTree = "<group>"; };
20032004
020D0BFC2914E92800BB3DCE /* StorePickerCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorePickerCoordinatorTests.swift; sourceTree = "<group>"; };
2005+
020D0BFE2914F6BA00BB3DCE /* LoggedOutStoreCreationCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggedOutStoreCreationCoordinatorTests.swift; sourceTree = "<group>"; };
20042006
020DD48923229495005822B1 /* ProductsTabProductTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsTabProductTableViewCell.swift; sourceTree = "<group>"; };
20052007
020DD48C2322A617005822B1 /* ProductsTabProductViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductsTabProductViewModel.swift; sourceTree = "<group>"; };
20062008
020DD48E232392C9005822B1 /* UIViewController+AppReview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+AppReview.swift"; sourceTree = "<group>"; };
@@ -6159,6 +6161,7 @@
61596161
DE50295228BF4A8A00551736 /* JetpackConnectionWebViewModelTests.swift */,
61606162
0269A5E62913FD22003B20EB /* StoreCreationCoordinatorTests.swift */,
61616163
020D0BFC2914E92800BB3DCE /* StorePickerCoordinatorTests.swift */,
6164+
020D0BFE2914F6BA00BB3DCE /* LoggedOutStoreCreationCoordinatorTests.swift */,
61626165
);
61636166
path = Authentication;
61646167
sourceTree = "<group>";
@@ -11085,6 +11088,7 @@
1108511088
579CDF01274D811D00E8903D /* StoreStatsUsageTracksEventEmitterTests.swift in Sources */,
1108611089
262A2C2B2537A3330086C1BE /* MockRefunds.swift in Sources */,
1108711090
027F240C258371150021DB06 /* RefundShippingLabelViewModelTests.swift in Sources */,
11091+
020D0BFF2914F6BA00BB3DCE /* LoggedOutStoreCreationCoordinatorTests.swift in Sources */,
1108811092
D85136DD231E613900DD0539 /* ReviewsViewModelTests.swift in Sources */,
1108911093
DEFD6E61264990FB00E51E0D /* SitePluginListViewModelTests.swift in Sources */,
1109011094
02B2C831249C4C8D0040C83C /* TextFieldTextAlignmentTests.swift in Sources */,
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import TestKit
2+
import XCTest
3+
@testable import WooCommerce
4+
5+
final class LoggedOutStoreCreationCoordinatorTests: XCTestCase {
6+
private var navigationController: UINavigationController!
7+
private let window = UIWindow(frame: UIScreen.main.bounds)
8+
9+
override func setUp() {
10+
super.setUp()
11+
12+
window.makeKeyAndVisible()
13+
navigationController = .init()
14+
window.rootViewController = navigationController
15+
}
16+
17+
override func tearDown() {
18+
navigationController = nil
19+
window.resignKey()
20+
window.rootViewController = nil
21+
22+
super.tearDown()
23+
}
24+
25+
func test_start_shows_AccountCreationFormHostingController() throws {
26+
// Given
27+
let coordinator = LoggedOutStoreCreationCoordinator(source: .prologue, navigationController: navigationController)
28+
XCTAssertNil(navigationController.topViewController)
29+
30+
// When
31+
coordinator.start()
32+
33+
// Then
34+
assertThat(navigationController.topViewController, isAnInstanceOf: AccountCreationFormHostingController.self)
35+
}
36+
}

0 commit comments

Comments
 (0)