Skip to content

Commit

Permalink
Fix StackBasedNavigation.md (#2944)
Browse files Browse the repository at this point in the history
  • Loading branch information
takehilo authored Mar 25, 2024
1 parent aa41151 commit 2722a34
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ stack in order to confirm that the count goes up by one, but in order to do so w
an ID:

```swift
await store.send(\.path[id: ???].incrementButtonTapped) {
await store.send(\.path[id: ???].counter.incrementButtonTapped) {
// ...
}
```
Expand All @@ -423,7 +423,7 @@ This means that when the ``TestStore`` were constructed with a single element al
that it was given an ID of 0, and so that is the ID we can use when sending an action:

```swift
await store.send(\.path[id: 0].incrementButtonTapped) {
await store.send(\.path[id: 0].counter.incrementButtonTapped) {
// ...
}
```
Expand All @@ -437,7 +437,7 @@ The library provides two different tools to perform all of these steps in a sing
use the `XCTModify` helper:

```swift
await store.send(\.path[id: 0].incrementButtonTapped) {
await store.send(\.path[id: 0].counter.incrementButtonTapped) {
XCTModify(&$0.path[id: 0], case: \.counter) {
$0.count = 4
}
Expand All @@ -455,7 +455,7 @@ Another option is to use ``StackState/subscript(id:case:)-7gczr`` to simultaneou
ID on the stack _and_ a case of the path enum:

```swift
await store.send(\.path[id: 0].incrementButtonTapped) {
await store.send(\.path[id: 0].counter.incrementButtonTapped) {
$0.path[id: 0, case: \.counter]?.count = 4
}
```
Expand All @@ -466,7 +466,7 @@ The `XCTModify` style is best when you have many things you need to modify on th
Continuing with the test, we can send it one more time to see that the count goes up to 5:

```swift
await store.send(\.path[id: 0].incrementButtonTapped) {
await store.send(\.path[id: 0].counter.incrementButtonTapped) {
XCTModify(&$0.path[id: 0], case: \.counter) {
$0.count = 5
}
Expand Down Expand Up @@ -525,8 +525,8 @@ func testDismissal() {
}
store.exhaustivity = .off

await store.send(\.path[id: 0].incrementButtonTapped)
await store.send(\.path[id: 0].incrementButtonTapped)
await store.send(\.path[id: 0].counter.incrementButtonTapped)
await store.send(\.path[id: 0].counter.incrementButtonTapped)
await store.receive(\.path.popFrom)
}
```
Expand Down

0 comments on commit 2722a34

Please sign in to comment.