@@ -6,7 +6,7 @@ import XCTest
6
6
7
7
@MainActor
8
8
class AnimationTests : XCTestCase {
9
- func testRainbow( ) {
9
+ func testRainbow( ) async {
10
10
let mainQueue = TestScheduler ( )
11
11
12
12
let store = TestStore (
@@ -17,44 +17,44 @@ class AnimationTests: XCTestCase {
17
17
)
18
18
)
19
19
20
- store. send ( . rainbowButtonTapped)
20
+ await store. send ( . rainbowButtonTapped)
21
21
22
- store. receive ( . setColor( . red) ) {
22
+ await store. receive ( . setColor( . red) ) {
23
23
$0. circleColor = . red
24
24
}
25
25
26
26
await mainQueue. advance ( by: . seconds( 1 ) )
27
- store. receive ( . setColor( . blue) ) {
27
+ await store. receive ( . setColor( . blue) ) {
28
28
$0. circleColor = . blue
29
29
}
30
30
31
31
await mainQueue. advance ( by: . seconds( 1 ) )
32
- store. receive ( . setColor( . green) ) {
32
+ await store. receive ( . setColor( . green) ) {
33
33
$0. circleColor = . green
34
34
}
35
35
36
36
await mainQueue. advance ( by: . seconds( 1 ) )
37
- store. receive ( . setColor( . orange) ) {
37
+ await store. receive ( . setColor( . orange) ) {
38
38
$0. circleColor = . orange
39
39
}
40
40
41
41
await mainQueue. advance ( by: . seconds( 1 ) )
42
- store. receive ( . setColor( . pink) ) {
42
+ await store. receive ( . setColor( . pink) ) {
43
43
$0. circleColor = . pink
44
44
}
45
45
46
46
await mainQueue. advance ( by: . seconds( 1 ) )
47
- store. receive ( . setColor( . purple) ) {
47
+ await store. receive ( . setColor( . purple) ) {
48
48
$0. circleColor = . purple
49
49
}
50
50
51
51
await mainQueue. advance ( by: . seconds( 1 ) )
52
- store. receive ( . setColor( . yellow) ) {
52
+ await store. receive ( . setColor( . yellow) ) {
53
53
$0. circleColor = . yellow
54
54
}
55
55
56
56
await mainQueue. advance ( by: . seconds( 1 ) )
57
- store. receive ( . setColor( . black) ) {
57
+ await store. receive ( . setColor( . black) ) {
58
58
$0. circleColor = . black
59
59
}
60
60
@@ -63,41 +63,41 @@ class AnimationTests: XCTestCase {
63
63
await mainQueue. advance ( by: . seconds( 10 ) )
64
64
}
65
65
66
- func testReset( ) async {
67
- let mainQueue = TestScheduler ( )
66
+ func testReset( ) async {
67
+ let mainQueue = TestScheduler ( )
68
68
69
- let store = TestStore (
70
- initialState: AnimationsState ( ) ,
71
- reducer: animationsReducer,
72
- environment: AnimationsEnvironment (
73
- mainQueue: mainQueue
74
- )
69
+ let store = TestStore (
70
+ initialState: AnimationsState ( ) ,
71
+ reducer: animationsReducer,
72
+ environment: AnimationsEnvironment (
73
+ mainQueue: mainQueue
75
74
)
75
+ )
76
+
77
+ await store. send ( . rainbowButtonTapped)
76
78
77
- await store. send ( . rainbowButtonTapped)
78
-
79
- await store. receive ( . setColor( . red) ) {
80
- $0. circleColor = . red
81
- }
82
-
83
- await mainQueue. advance ( by: . seconds( 1 ) )
84
- await store. receive ( . setColor( . blue) ) {
85
- $0. circleColor = . blue
86
- }
87
-
88
- await store. send ( . resetButtonTapped) {
89
- $0. alert = AlertState (
90
- title: TextState ( " Reset state? " ) ,
91
- primaryButton: . destructive(
92
- TextState ( " Reset " ) ,
93
- action: . send( . resetConfirmationButtonTapped, animation: . default)
94
- ) ,
95
- secondaryButton: . cancel( TextState ( " Cancel " ) )
96
- )
97
- }
98
-
99
- await store. send ( . resetConfirmationButtonTapped) {
100
- $0 = AnimationsState ( )
101
- }
79
+ await store. receive ( . setColor( . red) ) {
80
+ $0. circleColor = . red
102
81
}
82
+
83
+ await mainQueue. advance ( by: . seconds( 1 ) )
84
+ await store. receive ( . setColor( . blue) ) {
85
+ $0. circleColor = . blue
86
+ }
87
+
88
+ await store. send ( . resetButtonTapped) {
89
+ $0. alert = AlertState (
90
+ title: TextState ( " Reset state? " ) ,
91
+ primaryButton: . destructive(
92
+ TextState ( " Reset " ) ,
93
+ action: . send( . resetConfirmationButtonTapped, animation: . default)
94
+ ) ,
95
+ secondaryButton: . cancel( TextState ( " Cancel " ) )
96
+ )
97
+ }
98
+
99
+ await store. send ( . resetConfirmationButtonTapped) {
100
+ $0 = AnimationsState ( )
101
+ }
102
+ }
103
103
}
0 commit comments