Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ let store = TestStore(initialState: Settings.State()) {
Settings()
}

store.send(\.binding.displayName, "Blob") {
await store.send(\.binding.displayName, "Blob") {
$0.displayName = "Blob"
}
store.send(\.binding.protectMyPosts, true) {
await store.send(\.binding.protectMyPosts, true) {
$0.protectMyPosts = true
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ Modeling user actions with an enum rather than methods defined on some object is
- Having a data type of all actions in your feature also makes it possible to write exhaustive tests on every aspect of your feature. Using something known as a [`TestStore`][test-store-docs] you can emulate user flows by sending it actions and asserting how state changes each step of the way. And further, you must also assert on how effects feed their data back into the system by asserting on actions received:

```swift
store.send(.refreshButtonTapped) {
await store.send(.refreshButtonTapped) {
$0.isLoading = true
}
store.receive(\.userResponse) {
await store.receive(\.userResponse) {
$0.currentUser = User(id: 42, name: "Blob")
$0.isLoading = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ changes of `signUpData` to be automatically persisted to the file system you can
```swift
@ObservableState
struct State {
@Shared(.fileStorage(URL(/* ... */) var signUpData = SignUpData()
@Shared(.fileStorage(URL(/* ... */))) var signUpData = SignUpData()
// ...
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Xcode previews. It works like SwiftUI's `Binding.constant`, but for shared refer
Feature()
}
)
)
}
```

## Migrating to 1.11.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ let store = TestStore(initialState: Feature.State()) {
Feature()
}

store.send(.buttonTapped) {
await store.send(.buttonTapped) {
$0.count = 1
}
store.receive(\.sharedComputation) {
await store.receive(\.sharedComputation) {
// Assert on shared logic
}
store.send(.toggleChanged) {
await store.send(.toggleChanged) {
$0.isEnabled = true
}
store.receive(\.sharedComputation) {
await store.receive(\.sharedComputation) {
// Assert on shared logic
}
store.send(.textFieldChanged("Hello")) {
await store.send(.textFieldChanged("Hello")) {
$0.description = "Hello"
}
store.receive(\.sharedComputation) {
await store.receive(\.sharedComputation) {
// Assert on shared logic
}
```
Expand Down Expand Up @@ -167,15 +167,15 @@ let store = TestStore(initialState: Feature.State()) {
Feature()
}

store.send(.buttonTapped) {
await store.send(.buttonTapped) {
$0.count = 1
// Assert on shared logic
}
store.send(.toggleChanged) {
await store.send(.toggleChanged) {
$0.isEnabled = true
// Assert on shared logic
}
store.send(.textFieldChanged("Hello")) {
await store.send(.textFieldChanged("Hello")) {
$0.description = "Hello"
// Assert on shared logic
}
Expand Down