@@ -4,9 +4,8 @@ import XCTest
4
4
@testable import SwiftUICaseStudies
5
5
6
6
final class EffectsCancellationTests : XCTestCase {
7
- @MainActor
8
7
func testTrivia_SuccessfulRequest( ) async {
9
- let store = TestStore ( initialState: EffectsCancellation . State ( ) ) {
8
+ let store = await TestStore ( initialState: EffectsCancellation . State ( ) ) {
10
9
EffectsCancellation ( )
11
10
} withDependencies: {
12
11
$0. factClient. fetch = { " \( $0) is a good number Brent " }
@@ -27,10 +26,9 @@ final class EffectsCancellationTests: XCTestCase {
27
26
}
28
27
}
29
28
30
- @MainActor
31
29
func testTrivia_FailedRequest( ) async {
32
30
struct FactError : Equatable , Error { }
33
- let store = TestStore ( initialState: EffectsCancellation . State ( ) ) {
31
+ let store = await TestStore ( initialState: EffectsCancellation . State ( ) ) {
34
32
EffectsCancellation ( )
35
33
} withDependencies: {
36
34
$0. factClient. fetch = { _ in throw FactError ( ) }
@@ -50,9 +48,8 @@ final class EffectsCancellationTests: XCTestCase {
50
48
// in the `.cancelButtonTapped` action of the `effectsCancellationReducer`. This will cause the
51
49
// test to fail, showing that we are exhaustively asserting that the effect truly is canceled and
52
50
// will never emit.
53
- @MainActor
54
51
func testTrivia_CancelButtonCancelsRequest( ) async {
55
- let store = TestStore ( initialState: EffectsCancellation . State ( ) ) {
52
+ let store = await TestStore ( initialState: EffectsCancellation . State ( ) ) {
56
53
EffectsCancellation ( )
57
54
} withDependencies: {
58
55
$0. factClient. fetch = { _ in try await Task . never ( ) }
@@ -66,9 +63,8 @@ final class EffectsCancellationTests: XCTestCase {
66
63
}
67
64
}
68
65
69
- @MainActor
70
66
func testTrivia_PlusMinusButtonsCancelsRequest( ) async {
71
- let store = TestStore ( initialState: EffectsCancellation . State ( ) ) {
67
+ let store = await TestStore ( initialState: EffectsCancellation . State ( ) ) {
72
68
EffectsCancellation ( )
73
69
} withDependencies: {
74
70
$0. factClient. fetch = { _ in try await Task . never ( ) }
0 commit comments