Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
adding a blurb on expect-thunk in README.md
  • Loading branch information
obj-p committed Feb 25, 2019
commit 2440ec2fcbfb33cfa6be04edf61568ab7e441877
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ store.dispatch(thunkWithParams(10))
// Note that these actions won't reach the reducers, instead, the thunks middleware will catch it and execute its body, producing the desired side effects.
```

## Testing

The `ExpectThunk` helper, available as a CocoaPods subspec, allows for testing the order and contents of `dispatch` actions as well as the dependencies on `getState` contained within a thunk.

```swift
let expect = ExpectThunk(thunk)
.getsState(RequestState(loading: false))
// If the action is Equatable it will be asserted for equality with `dispatches`.
.dispatches(RequestStart())
.dispatches { action in
XCTAssert(action.something == expectedSomething)
}
.run()

wait(for: [expect], timeout: someTimeout)
```

## Installation

ReSwift-Thunk requires the [ReSwift](https://github.com/ReSwift/ReSwift/) base module.
Expand All @@ -68,7 +85,13 @@ ReSwift-Thunk requires the [ReSwift](https://github.com/ReSwift/ReSwift/) base m

You can install ReSwift-Thunk via CocoaPods by adding it to your `Podfile`:
```
pod 'ReSwiftThunk'
target 'TARGET' do
pod 'ReSwiftThunk'
end

target 'TARGET-TESTS' do
pod 'ReSwiftThunk/ExpectThunk'
end
```

And run `pod install`.
Expand Down