Skip to content

Commit 8e78b84

Browse files
stephencelisgithub-actions[bot]
authored andcommitted
Run swift-format
1 parent a1e454c commit 8e78b84

File tree

3 files changed

+87
-86
lines changed

3 files changed

+87
-86
lines changed

Tests/ComposableArchitectureTests/Reducers/IfCaseLetReducerTests.swift

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@ import XCTest
44
@MainActor
55
final class IfCaseLetReducerTests: BaseTCATestCase {
66
func testChildAction() async {
7-
struct SomeError: Error, Equatable {}
7+
struct SomeError: Error, Equatable {}
88

9-
let store = TestStore(initialState: Result.success(0)) {
10-
Reduce<Result<Int, SomeError>, Result<Int, SomeError>> { state, action in
11-
.none
12-
}
13-
.ifCaseLet(/Result.success, action: /Result.success) {
14-
Reduce { state, action in
15-
state = action
16-
return state < 0 ? .run { await $0(0) } : .none
17-
}
9+
let store = TestStore(initialState: Result.success(0)) {
10+
Reduce<Result<Int, SomeError>, Result<Int, SomeError>> { state, action in
11+
.none
12+
}
13+
.ifCaseLet(/Result.success, action: /Result.success) {
14+
Reduce { state, action in
15+
state = action
16+
return state < 0 ? .run { await $0(0) } : .none
1817
}
1918
}
19+
}
2020

21-
await store.send(.success(1)) {
22-
$0 = .success(1)
23-
}
24-
await store.send(.failure(SomeError()))
25-
await store.send(.success(-1)) {
26-
$0 = .success(-1)
27-
}
28-
await store.receive(.success(0)) {
29-
$0 = .success(0)
30-
}
21+
await store.send(.success(1)) {
22+
$0 = .success(1)
23+
}
24+
await store.send(.failure(SomeError()))
25+
await store.send(.success(-1)) {
26+
$0 = .success(-1)
27+
}
28+
await store.receive(.success(0)) {
29+
$0 = .success(0)
30+
}
3131
}
3232

3333
#if DEBUG
@@ -128,22 +128,22 @@ final class IfCaseLetReducerTests: BaseTCATestCase {
128128
}
129129
}
130130
}
131-
let clock = TestClock()
132-
let store = TestStore(initialState: Parent.State.child1(Child.State())) {
133-
Parent()
134-
} withDependencies: {
135-
$0.continuousClock = clock
136-
}
137-
await store.send(.child1(.timerButtonTapped))
138-
await clock.advance(by: .seconds(1))
139-
await store.receive(.child1(.timerTick)) {
140-
try (/Parent.State.child1).modify(&$0) {
141-
$0.count = 1
142-
}
143-
}
144-
await store.send(.child2ButtonTapped) {
145-
$0 = .child2(Child.State())
131+
let clock = TestClock()
132+
let store = TestStore(initialState: Parent.State.child1(Child.State())) {
133+
Parent()
134+
} withDependencies: {
135+
$0.continuousClock = clock
136+
}
137+
await store.send(.child1(.timerButtonTapped))
138+
await clock.advance(by: .seconds(1))
139+
await store.receive(.child1(.timerTick)) {
140+
try (/Parent.State.child1).modify(&$0) {
141+
$0.count = 1
146142
}
143+
}
144+
await store.send(.child2ButtonTapped) {
145+
$0 = .child2(Child.State())
146+
}
147147
}
148148
}
149149

Tests/ComposableArchitectureTests/Reducers/IfLetReducerTests.swift

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -87,30 +87,30 @@ final class IfLetReducerTests: BaseTCATestCase {
8787
}
8888
}
8989
}
90-
let clock = TestClock()
91-
let store = TestStore(initialState: Parent.State()) {
92-
Parent()
93-
} withDependencies: {
94-
$0.continuousClock = clock
95-
}
96-
await store.send(.childButtonTapped) {
97-
$0.child = Child.State()
98-
}
99-
await store.send(.child(.timerButtonTapped))
100-
await clock.advance(by: .seconds(2))
101-
await store.receive(.child(.timerTick)) {
102-
try (/.some).modify(&$0.child) {
103-
$0.count = 1
104-
}
105-
}
106-
await store.receive(.child(.timerTick)) {
107-
try (/.some).modify(&$0.child) {
108-
$0.count = 2
109-
}
90+
let clock = TestClock()
91+
let store = TestStore(initialState: Parent.State()) {
92+
Parent()
93+
} withDependencies: {
94+
$0.continuousClock = clock
95+
}
96+
await store.send(.childButtonTapped) {
97+
$0.child = Child.State()
98+
}
99+
await store.send(.child(.timerButtonTapped))
100+
await clock.advance(by: .seconds(2))
101+
await store.receive(.child(.timerTick)) {
102+
try (/.some).modify(&$0.child) {
103+
$0.count = 1
110104
}
111-
await store.send(.childButtonTapped) {
112-
$0.child = nil
105+
}
106+
await store.receive(.child(.timerTick)) {
107+
try (/.some).modify(&$0.child) {
108+
$0.count = 2
113109
}
110+
}
111+
await store.send(.childButtonTapped) {
112+
$0.child = nil
113+
}
114114
}
115115
}
116116

@@ -180,27 +180,27 @@ final class IfLetReducerTests: BaseTCATestCase {
180180
}
181181
}
182182
}
183-
let clock = TestClock()
184-
let store = TestStore(initialState: Parent.State()) {
185-
Parent()
186-
} withDependencies: {
187-
$0.continuousClock = clock
188-
}
189-
await store.send(.startButtonTapped) {
190-
$0.child = Child.State(grandChild: GrandChild.State())
191-
}
192-
await store.send(.child(.grandChild(.timerButtonTapped)))
193-
await clock.advance(by: .seconds(1))
194-
await store.receive(.child(.grandChild(.timerTick))) {
195-
try (/.some).modify(&$0.child) {
196-
try (/.some).modify(&$0.grandChild) {
197-
$0.count = 1
198-
}
183+
let clock = TestClock()
184+
let store = TestStore(initialState: Parent.State()) {
185+
Parent()
186+
} withDependencies: {
187+
$0.continuousClock = clock
188+
}
189+
await store.send(.startButtonTapped) {
190+
$0.child = Child.State(grandChild: GrandChild.State())
191+
}
192+
await store.send(.child(.grandChild(.timerButtonTapped)))
193+
await clock.advance(by: .seconds(1))
194+
await store.receive(.child(.grandChild(.timerTick))) {
195+
try (/.some).modify(&$0.child) {
196+
try (/.some).modify(&$0.grandChild) {
197+
$0.count = 1
199198
}
200199
}
201-
await store.send(.exitButtonTapped) {
202-
$0.child = nil
203-
}
200+
}
201+
await store.send(.exitButtonTapped) {
202+
$0.child = nil
203+
}
204204
}
205205
}
206206

@@ -229,15 +229,15 @@ final class IfLetReducerTests: BaseTCATestCase {
229229
}
230230
}
231231
}
232-
let store = TestStore(initialState: Parent.State()) {
233-
Parent()
234-
}
235-
await store.send(.tap) {
236-
$0.alert = AlertState { TextState("Hi!") }
237-
}
238-
await store.send(.alert(.ok)) {
239-
$0.alert = nil
240-
}
232+
let store = TestStore(initialState: Parent.State()) {
233+
Parent()
234+
}
235+
await store.send(.tap) {
236+
$0.alert = AlertState { TextState("Hi!") }
237+
}
238+
await store.send(.alert(.ok)) {
239+
$0.alert = nil
240+
}
241241
}
242242
}
243243

Tests/ComposableArchitectureTests/TestStoreTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ final class TestStoreTests: BaseTCATestCase {
484484
Reduce<State, Action> { state, action in
485485
switch action {
486486
case .start:
487-
return subject
487+
return
488+
subject
488489
.subscribe(on: scheduler)
489490
.receive(on: scheduler)
490491
.map { .increment }

0 commit comments

Comments
 (0)