Skip to content

Commit 2dd42ce

Browse files
committed
Fix tests
1 parent d69b5db commit 2dd42ce

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

Examples/Standups/StandupsTests/AppFeatureTests.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class AppFeatureTests: XCTestCase {
4141
}
4242

4343
func testDetailEdit() async throws {
44-
let standup = Standup.mock
44+
var standup = Standup.mock
4545
let savedData = LockIsolated(Data?.none)
4646

4747
let store = TestStore(initialState: AppFeature.State()) {
@@ -67,11 +67,12 @@ final class AppFeatureTests: XCTestCase {
6767
)
6868
}
6969

70+
standup.title = "Blob"
7071
await store.send(
7172
.path(
7273
.element(
7374
id: 0,
74-
action: .detail(.destination(.presented(.edit(.binding(.set(\.$standup.title, "Blob"))))))
75+
action: .detail(.destination(.presented(.edit(.binding(.set(\.$standup, standup))))))
7576
)
7677
)
7778
) {

Examples/Standups/StandupsTests/StandupDetailTests.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,19 @@ final class StandupDetailTests: XCTestCase {
8484
}
8585

8686
func testEdit() async {
87-
let store = TestStore(initialState: StandupDetail.State(standup: .mock)) {
87+
var standup = Standup.mock
88+
let store = TestStore(initialState: StandupDetail.State(standup: standup)) {
8889
StandupDetail()
8990
} withDependencies: {
9091
$0.uuid = .incrementing
9192
}
9293

9394
await store.send(.editButtonTapped) {
94-
$0.destination = .edit(StandupForm.State(standup: .mock))
95+
$0.destination = .edit(StandupForm.State(standup: standup))
9596
}
9697

97-
await store.send(.destination(.presented(.edit(.set(\.$standup.title, "Blob's Meeting"))))) {
98+
standup.title = "Blob's Meeting"
99+
await store.send(.destination(.presented(.edit(.set(\.$standup, standup))))) {
98100
try (/StandupDetail.Destination.State.edit).modify(&$0.destination) {
99101
$0.standup.title = "Blob's Meeting"
100102
}

Examples/Standups/StandupsTests/StandupsListTests.swift

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,26 @@ final class StandupsListTests: XCTestCase {
1414
$0.uuid = .incrementing
1515
}
1616

17+
var standup = Standup(
18+
id: Standup.ID(UUID(0)),
19+
attendees: [
20+
Attendee(id: Attendee.ID(UUID(1)))
21+
]
22+
)
1723
await store.send(.addStandupButtonTapped) {
18-
$0.destination = .add(
19-
StandupForm.State(
20-
standup: Standup(
21-
id: Standup.ID(UUID(0)),
22-
attendees: [
23-
Attendee(id: Attendee.ID(UUID(1)))
24-
]
25-
)
26-
)
27-
)
24+
$0.destination = .add(StandupForm.State(standup: standup))
2825
}
2926

27+
standup.title = "Engineering"
3028
await store.send(
31-
.destination(.presented(.add(.binding(.set(\.$standup.title, "Engineering")))))
29+
.destination(.presented(.add(.binding(.set(\.$standup, standup)))))
3230
) {
3331
$0.$destination[case: /StandupsList.Destination.State.add]?.standup.title = "Engineering"
3432
}
3533

3634
await store.send(.confirmAddStandupButtonTapped) {
3735
$0.destination = nil
38-
$0.standups = [
39-
Standup(
40-
id: Standup.ID(UUID(0)),
41-
attendees: [
42-
Attendee(id: Attendee.ID(UUID(1)))
43-
],
44-
title: "Engineering"
45-
)
46-
]
36+
$0.standups = [standup]
4737
}
4838
}
4939

0 commit comments

Comments
 (0)