@@ -6,7 +6,7 @@ import XCTest
66
77@MainActor
88class AnimationTests : XCTestCase {
9- func testRainbow( ) {
9+ func testRainbow( ) async {
1010 let mainQueue = TestScheduler ( )
1111
1212 let store = TestStore (
@@ -17,44 +17,44 @@ class AnimationTests: XCTestCase {
1717 )
1818 )
1919
20- store. send ( . rainbowButtonTapped)
20+ await store. send ( . rainbowButtonTapped)
2121
22- store. receive ( . setColor( . red) ) {
22+ await store. receive ( . setColor( . red) ) {
2323 $0. circleColor = . red
2424 }
2525
2626 await mainQueue. advance ( by: . seconds( 1 ) )
27- store. receive ( . setColor( . blue) ) {
27+ await store. receive ( . setColor( . blue) ) {
2828 $0. circleColor = . blue
2929 }
3030
3131 await mainQueue. advance ( by: . seconds( 1 ) )
32- store. receive ( . setColor( . green) ) {
32+ await store. receive ( . setColor( . green) ) {
3333 $0. circleColor = . green
3434 }
3535
3636 await mainQueue. advance ( by: . seconds( 1 ) )
37- store. receive ( . setColor( . orange) ) {
37+ await store. receive ( . setColor( . orange) ) {
3838 $0. circleColor = . orange
3939 }
4040
4141 await mainQueue. advance ( by: . seconds( 1 ) )
42- store. receive ( . setColor( . pink) ) {
42+ await store. receive ( . setColor( . pink) ) {
4343 $0. circleColor = . pink
4444 }
4545
4646 await mainQueue. advance ( by: . seconds( 1 ) )
47- store. receive ( . setColor( . purple) ) {
47+ await store. receive ( . setColor( . purple) ) {
4848 $0. circleColor = . purple
4949 }
5050
5151 await mainQueue. advance ( by: . seconds( 1 ) )
52- store. receive ( . setColor( . yellow) ) {
52+ await store. receive ( . setColor( . yellow) ) {
5353 $0. circleColor = . yellow
5454 }
5555
5656 await mainQueue. advance ( by: . seconds( 1 ) )
57- store. receive ( . setColor( . black) ) {
57+ await store. receive ( . setColor( . black) ) {
5858 $0. circleColor = . black
5959 }
6060
@@ -63,41 +63,41 @@ class AnimationTests: XCTestCase {
6363 await mainQueue. advance ( by: . seconds( 10 ) )
6464 }
6565
66- func testReset( ) async {
67- let mainQueue = TestScheduler ( )
66+ func testReset( ) async {
67+ let mainQueue = TestScheduler ( )
6868
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
7574 )
75+ )
76+
77+ await store. send ( . rainbowButtonTapped)
7678
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
10281 }
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+ }
103103}
0 commit comments