File tree Expand file tree Collapse file tree
Sources/Toolbox/Coordinators Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ open class NavigationCoordinator: Coordinator {
1515 self . pushedViewControllers = WeakArray ( [ ] )
1616 self . navigationController = navigationController ?? UINavigationController ( )
1717
18- super. init ( rootViewController: navigationController)
18+ super. init ( rootViewController: self . navigationController)
1919
2020 if self . navigationController. delegate == nil {
2121 self . navigationController. delegate = self
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ open class TabBarCoordinator: Coordinator {
77
88 public init ( tabBarController: UITabBarController ? = nil ) {
99 self . tabBarController = tabBarController ?? UITabBarController ( )
10- super. init ( rootViewController: tabBarController! )
10+ super. init ( rootViewController: self . tabBarController)
1111 self . tabBarController. delegate = self
1212 }
1313
Original file line number Diff line number Diff line change 1+ @testable import Toolbox
2+ import XCTest
3+
4+ final class NavigationCoordinatorTests : XCTestCase {
5+
6+ func testNavigationCoordinatorInitialization( ) async throws {
7+ let expectation = XCTestExpectation ( description: " NavigationCoordinator initialization " )
8+
9+ // Switch to the main actor context.
10+ await MainActor . run {
11+ let navCoordinator = NavigationCoordinator ( )
12+
13+ // Test your coordinator instance here, e.g.:
14+ XCTAssertNotNil ( navCoordinator)
15+
16+ // Fulfill the expectation when the test is complete.
17+ expectation. fulfill ( )
18+ }
19+
20+ // Wait for the expectation to be fulfilled.
21+ wait ( for: [ expectation] , timeout: 10 )
22+ }
23+
24+ func testNavigationCoordinatorRootIsUINavigationController( ) async throws {
25+ let expectation = XCTestExpectation ( description: " NavigationCoordinator initialization " )
26+
27+ // Switch to the main actor context.
28+ await MainActor . run {
29+ let navCoordinator = NavigationCoordinator ( )
30+
31+ // Test your coordinator instance here, e.g.:
32+ XCTAssertNotNil ( navCoordinator)
33+
34+ // Check if the rootViewController is of type UITabBarController
35+ XCTAssertTrue ( navCoordinator. rootViewController is UINavigationController )
36+
37+ // Fulfill the expectation when the test is complete.
38+ expectation. fulfill ( )
39+ }
40+
41+ // Wait for the expectation to be fulfilled.
42+ wait ( for: [ expectation] , timeout: 10 )
43+ }
44+
45+ }
Original file line number Diff line number Diff line change 1+ @testable import Toolbox
2+ import XCTest
3+
4+ final class TabBarCoordinatorTests : XCTestCase {
5+
6+ func testTabBarCoordinatorInitialization( ) async throws {
7+ let expectation = XCTestExpectation ( description: " TabBarCoordinator initialization " )
8+
9+ // Switch to the main actor context.
10+ await MainActor . run {
11+ let mainCoordinator = TabBarCoordinator ( )
12+
13+ // Test your coordinator instance here, e.g.:
14+ XCTAssertNotNil ( mainCoordinator)
15+
16+ // Fulfill the expectation when the test is complete.
17+ expectation. fulfill ( )
18+ }
19+
20+ // Wait for the expectation to be fulfilled.
21+ wait ( for: [ expectation] , timeout: 10 )
22+ }
23+
24+ func testTabBarCoordinatorRootIsUITabBarController( ) async throws {
25+ let expectation = XCTestExpectation ( description: " TabBarCoordinator initialization " )
26+
27+ // Switch to the main actor context.
28+ await MainActor . run {
29+ let tabBarCoordinator = TabBarCoordinator ( )
30+
31+ // Test your coordinator instance here, e.g.:
32+ XCTAssertNotNil ( tabBarCoordinator)
33+
34+ // Check if the rootViewController is of type UITabBarController
35+ XCTAssertTrue ( tabBarCoordinator. rootViewController is UITabBarController )
36+
37+ // Fulfill the expectation when the test is complete.
38+ expectation. fulfill ( )
39+ }
40+
41+ // Wait for the expectation to be fulfilled.
42+ wait ( for: [ expectation] , timeout: 10 )
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments