@@ -4,37 +4,43 @@ import TestUtils
44final class CombinedTests : XCTestCase {
55 func test( ) {
66 let viewUsed = UnimplementedAnimatorTransientView ( )
7- let operationUsed = AtomicTransition . Operation . random ( )
8- let contextUsed = UnimplementedUIKitContext ( )
7+ let operationUsed = AtomicTransitionOperation . random ( )
8+ let containerUsed = UIView ( )
99
10- var sequence : [ Character ] = [ ]
11- let sut = AtomicTransition
12- . spy { view, operation, context in
10+ let expectation1 = self . expectation ( description: " Transition 1 " )
11+ let expectation2 = self . expectation ( description: " Transition 2 " )
12+ let expectation3 = self . expectation ( description: " Transition 3 " )
13+ let expectation4 = self . expectation ( description: " Transition 4 " )
14+
15+ let sut = Combined {
16+ Spy { view, operation, container in
1317 XCTAssertIdentical ( view, viewUsed)
1418 XCTAssertEqual ( operation, operationUsed)
15- XCTAssertIdentical ( context , contextUsed )
16- sequence . append ( " a " )
19+ XCTAssertIdentical ( container , containerUsed )
20+ expectation1 . fulfill ( )
1721 }
18- . combined ( with : . spy { view, operation, context in
22+ Spy { view, operation, container in
1923 XCTAssertIdentical ( view, viewUsed)
2024 XCTAssertEqual ( operation, operationUsed)
21- XCTAssertIdentical ( context , contextUsed )
22- sequence . append ( " b " )
23- } )
24- . combined ( with : . spy { view, operation, context in
25+ XCTAssertIdentical ( container , containerUsed )
26+ expectation2 . fulfill ( )
27+ }
28+ Spy { view, operation, container in
2529 XCTAssertIdentical ( view, viewUsed)
2630 XCTAssertEqual ( operation, operationUsed)
27- XCTAssertIdentical ( context , contextUsed )
28- sequence . append ( " c " )
29- } )
30- . combined ( with : . spy { view, operation, context in
31+ XCTAssertIdentical ( container , containerUsed )
32+ expectation3 . fulfill ( )
33+ }
34+ Spy { view, operation, container in
3135 XCTAssertIdentical ( view, viewUsed)
3236 XCTAssertEqual ( operation, operationUsed)
33- XCTAssertIdentical ( context, contextUsed)
34- sequence. append ( " d " )
35- } )
36- XCTAssertEqual ( sequence, [ ] )
37- sut. prepare ( viewUsed, for: operationUsed, in: contextUsed)
38- XCTAssertEqual ( sequence, [ " a " , " b " , " c " , " d " ] )
37+ XCTAssertIdentical ( container, containerUsed)
38+ expectation4. fulfill ( )
39+ }
40+ }
41+
42+ sut. transition ( viewUsed, for: operationUsed, in: containerUsed)
43+
44+ wait ( for: [ expectation1, expectation2, expectation3, expectation4] , timeout: 0 , enforceOrder: true )
3945 }
4046}
0 commit comments