Skip to content

Commit 0beba83

Browse files
committed
Update docs
1 parent ce294c9 commit 0beba83

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

docs/javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For plain javascript assertions you don't need to register anything. Just import
99
import { assertions } from 'redux-actions-assertions';
1010

1111
// using CommonJS modules
12-
var assertions = require('redux-actions-assertions');
12+
var assertions = require('redux-actions-assertions').assertions;
1313

1414
// in test
1515
assertions.toDispatchActions(/**/)

docs/tape.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
## Usage
44

5+
Usage is the same as the [plain JavaScript assertions](https://redux-things.github.io/redux-actions-assertions/javascript.html), you just need to set up the correct `pass` and `fail` callbacks. Also, be sure to call `end` in a `Promise.then`, or `plan` with the number of assertions you're making in the test (see below).
6+
57
```js
68
// using ES6 modules
79
import test from 'tape'
810
import { assertions } from 'redux-actions-assertions'
911

1012
// using CommonJS modules
1113
var test = require('tape')
12-
var assertions = require('redux-actions-assertions');
14+
var assertions = require('redux-actions-assertions').assertions;
1315
```
1416

1517
### toDispatchActions
@@ -18,9 +20,17 @@ var assertions = require('redux-actions-assertions');
1820
Asserts that when given `action` is dispatched it will dispatch `expectedActions`. `action` can be plain object (action) or function (action creator). `expectedActions` can be can be plain object (action) or function (action creator) or array of objects/functions.
1921

2022
```js
23+
// Using `t.plan`
2124
test('Thunk: editTag', (t) => {
25+
t.plan(1)
2226
toDispatchActions(testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
2327
})
28+
29+
// Using `t.end`
30+
test('Thunk: editTag', (t) => {
31+
toDispatchActions(testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail)
32+
.then(t.end);
33+
})
2434
```
2535

2636
### toNotDispatchActions
@@ -30,6 +40,7 @@ Asserts that when given `action` is dispatched it will not dispatch `expectedAct
3040

3141
```js
3242
test('Thunk: editTag', (t) => {
43+
t.plan(1)
3344
toNotDispatchActions(testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
3445
})
3546
```
@@ -42,6 +53,7 @@ Same as `toDispatchActions` + asserts that store initialised with `state` before
4253

4354
```js
4455
test('Thunk: editTag', (t) => {
56+
t.plan(1)
4557
toDispatchActions({property: 'value'}, testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
4658
})
4759
```
@@ -54,6 +66,7 @@ Same as `toNotDispatchActions` + asserts that store initialised with `state` bef
5466

5567
```js
5668
test('Thunk: editTag', (t) => {
69+
t.plan(1)
5770
toNotDispatchActions({property: 'value'}, testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
5871
})
5972
```

0 commit comments

Comments
 (0)