@@ -4,37 +4,43 @@ import TestUtils
4
4
final class CombinedTests : XCTestCase {
5
5
func test( ) {
6
6
let viewUsed = UnimplementedAnimatorTransientView ( )
7
- let operationUsed = AtomicTransition . Operation . random ( )
8
- let contextUsed = UnimplementedUIKitContext ( )
7
+ let operationUsed = AtomicTransitionOperation . random ( )
8
+ let containerUsed = UIView ( )
9
9
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
13
17
XCTAssertIdentical ( view, viewUsed)
14
18
XCTAssertEqual ( operation, operationUsed)
15
- XCTAssertIdentical ( context , contextUsed )
16
- sequence . append ( " a " )
19
+ XCTAssertIdentical ( container , containerUsed )
20
+ expectation1 . fulfill ( )
17
21
}
18
- . combined ( with : . spy { view, operation, context in
22
+ Spy { view, operation, container in
19
23
XCTAssertIdentical ( view, viewUsed)
20
24
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
25
29
XCTAssertIdentical ( view, viewUsed)
26
30
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
31
35
XCTAssertIdentical ( view, viewUsed)
32
36
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 )
39
45
}
40
46
}
0 commit comments