@@ -10,70 +10,57 @@ final class ProductDetailsFactoryTests: XCTestCase {
1010 // Arrange
1111 let product = Product . fake ( ) . copy ( productTypeKey: ProductType . simple. rawValue)
1212
13- let exp = expectation ( description: #function)
1413 // Action
15- ProductDetailsFactory . productDetails ( product: product,
16- presentationStyle: . navigationStack,
17- forceReadOnly: false ) { viewController in
18- // Assert
19- XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
20- exp. fulfill ( )
21- }
22- waitForExpectations ( timeout: Constants . expectationTimeout, handler: nil )
14+ let viewController = ProductDetailsFactory . productDetails ( product: product,
15+ presentationStyle: . navigationStack,
16+ forceReadOnly: false )
17+
18+ // Assert
19+ XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
2320 }
2421
2522 // MARK: External/affiliate product type
2623
2724 func test_factory_creates_product_form_for_affiliate_product( ) {
2825 // Arrange
2926 let product = Product . fake ( ) . copy ( productTypeKey: ProductType . affiliate. rawValue)
30- let exp = expectation ( description: #function)
3127
3228 // Action
33- ProductDetailsFactory . productDetails ( product: product,
34- presentationStyle: . navigationStack,
35- forceReadOnly: false ) { viewController in
36- // Assert
37- XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
38- exp. fulfill ( )
39- }
40- waitForExpectations ( timeout: Constants . expectationTimeout, handler: nil )
29+ let viewController = ProductDetailsFactory . productDetails ( product: product,
30+ presentationStyle: . navigationStack,
31+ forceReadOnly: false )
32+
33+ // Assert
34+ XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
4135 }
4236
4337 // MARK: Grouped product type
4438
4539 func test_factory_creates_product_form_for_grouped_product( ) {
4640 // Arrange
4741 let product = Product . fake ( ) . copy ( productTypeKey: ProductType . grouped. rawValue)
48- let exp = expectation ( description: #function)
4942
5043 // Action
51- ProductDetailsFactory . productDetails ( product: product,
52- presentationStyle: . navigationStack,
53- forceReadOnly: false ) { viewController in
54- // Assert
55- XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
56- exp. fulfill ( )
57- }
58- waitForExpectations ( timeout: Constants . expectationTimeout, handler: nil )
44+ let viewController = ProductDetailsFactory . productDetails ( product: product,
45+ presentationStyle: . navigationStack,
46+ forceReadOnly: false )
47+ // Assert
48+ XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
5949 }
6050
6151 // MARK: Variable product type
6252
6353 func test_factory_creates_product_form_for_variable_product( ) {
6454 // Arrange
6555 let product = Product . fake ( ) . copy ( productTypeKey: ProductType . variable. rawValue)
66- let exp = expectation ( description: #function)
6756
6857 // Action
69- ProductDetailsFactory . productDetails ( product: product,
70- presentationStyle: . navigationStack,
71- forceReadOnly: false ) { viewController in
72- // Assert
73- XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
74- exp. fulfill ( )
75- }
76- waitForExpectations ( timeout: Constants . expectationTimeout, handler: nil )
58+ let viewController = ProductDetailsFactory . productDetails ( product: product,
59+ presentationStyle: . navigationStack,
60+ forceReadOnly: false )
61+
62+ // Assert
63+ XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
7764 }
7865
7966 // MARK: Non-core product type
@@ -83,30 +70,22 @@ final class ProductDetailsFactoryTests: XCTestCase {
8370 let product = Product . fake ( ) . copy ( productTypeKey: " other " )
8471
8572 // Action
86- waitForExpectation { expectation in
87- ProductDetailsFactory . productDetails ( product: product,
88- presentationStyle: . navigationStack,
89- forceReadOnly: false ) { viewController in
90- // Assert
91- XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
92- expectation. fulfill ( )
93- }
94- }
73+ let viewController = ProductDetailsFactory . productDetails ( product: product,
74+ presentationStyle: . navigationStack,
75+ forceReadOnly: false )
76+ // Assert
77+ XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
9578 }
9679
9780 func test_factory_creates_readonly_product_details_for_product_when_forceReadOnly_is_on( ) {
9881 // Arrange
9982 let product = Product . fake ( ) . copy ( productTypeKey: ProductType . simple. rawValue)
10083
10184 // Action
102- waitForExpectation { expectation in
103- ProductDetailsFactory . productDetails ( product: product,
104- presentationStyle: . navigationStack,
105- forceReadOnly: true ) { viewController in
106- // Assert
107- XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
108- expectation. fulfill ( )
109- }
110- }
85+ let viewController = ProductDetailsFactory . productDetails ( product: product,
86+ presentationStyle: . navigationStack,
87+ forceReadOnly: true )
88+ // Assert
89+ XCTAssertTrue ( viewController is ProductFormViewController < ProductFormViewModel > )
11190 }
11291}
0 commit comments