Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/srounce/redux-observable-expect
Straightforward testing for redux-observable epics.
https://github.com/srounce/redux-observable-expect
Last synced: 8 days ago
JSON representation
Straightforward testing for redux-observable epics.
- Host: GitHub
- URL: https://github.com/srounce/redux-observable-expect
- Owner: srounce
- Created: 2017-09-06T12:20:08.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-06T12:36:12.000Z (about 7 years ago)
- Last Synced: 2024-08-09T22:12:06.282Z (3 months ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# redux-observable-expect
Test redux-observable epics with ease.## Problem
> "I've written unit tests for my redux-observable epic(s) and have a lot of
> test boilerplate. How can I reduce this barrier-to-test?"## API
```javascript
expectEpic(
epic: (action$: Observable, store: ReduxStore) => Observable,
condition$: Observable,
expect$: Observable,
assert: (a: any, b: any) => ?boolean,
done: () => ?any,
store: ReduxStore
)
```* **epic:** The redux-observable 'epic' function you would like to test.
* **condition$:** The input actions for the test case.
* **expect$:** The stream of actions to be compared with the stream returned
from **epic**.
* **assert:** A function which compares actions from the **epic** with the
contents of **expect$**
* **done:** Completion callback (usually provided by your test runner).
* **store:** _(Optional)_ A redux store, will be needed if your epic consumes
data from the store.## Example
```javascript
import expectEpic from 'redux-observable-expect'expectEpic(
myAwesomeEpic
of({ type: TRIGGER_TYPE }),
of(
{ type: EXPECTED_TYPE },
{ type: ANOTHER_EXPECTED_TYPE }
),
(a, b) => expect(a).toEqual(b),
done
)
```## Contributing
This project uses JS standard style.Add stuff, write tests, make tests & linting pass, send a PR.