Skip to content

Commit ce294c9

Browse files
committed
Add tape
1 parent c36574f commit ce294c9

File tree

5 files changed

+81
-3
lines changed

5 files changed

+81
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ It use [redux-mock-store](https://github.com/arnaudbenard/redux-mock-store) to m
1212
- [expect](https://redux-things.github.io/redux-actions-assertions/expect.html)
1313
- [expect.js](https://redux-things.github.io/redux-actions-assertions/expectjs.html)
1414
- [should](https://redux-things.github.io/redux-actions-assertions/should.html)
15+
- [tape](https://redux-things.github.io/redux-actions-assertions/tape.html)
1516
- [pure javascript assertion](https://redux-things.github.io/redux-actions-assertions/javascript.html)
1617

1718
If you have not found assertion framework/library that you are using - please add comment into [this issue](https://github.com/dmitry-zaets/redux-actions-assertions/issues/3).

docs/javascript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ For plain javascript assertions you don't need to register anything. Just import
66

77
```js
88
// using ES6 modules
9-
import assertions from 'redux-actions-assertions';
9+
import { assertions } from 'redux-actions-assertions';
1010

1111
// using CommonJS modules
1212
var assertions = require('redux-actions-assertions');
@@ -56,4 +56,4 @@ Same as `toNotDispatchActions` + asserts that store initialised with `state` bef
5656

5757
```js
5858
toNotDispatchActions({property: 'value'}, testActionCreator(), [{ type: 'MY_ACTION_START' }], callback);
59-
```
59+
```

docs/tape.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# [tape](https://github.com/substack/tape)
2+
3+
## Usage
4+
5+
```js
6+
// using ES6 modules
7+
import test from 'tape'
8+
import { assertions } from 'redux-actions-assertions'
9+
10+
// using CommonJS modules
11+
var test = require('tape')
12+
var assertions = require('redux-actions-assertions');
13+
```
14+
15+
### toDispatchActions
16+
> `toDispatchActions(action, expectedActions, done, fail)`
17+
18+
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.
19+
20+
```js
21+
test('Thunk: editTag', (t) => {
22+
toDispatchActions(testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
23+
})
24+
```
25+
26+
### toNotDispatchActions
27+
> `toNotDispatchActions(action, expectedActions, done, fail)`
28+
29+
Asserts that when given `action` is dispatched it will not 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.
30+
31+
```js
32+
test('Thunk: editTag', (t) => {
33+
toNotDispatchActions(testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
34+
})
35+
```
36+
37+
### toDispatchActionsWithState
38+
39+
> `toDispatchActionsWithState(initialState, action, expectedActions, done, fail)`
40+
41+
Same as `toDispatchActions` + asserts that store initialised with `state` before `action` is dispatched.
42+
43+
```js
44+
test('Thunk: editTag', (t) => {
45+
toDispatchActions({property: 'value'}, testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
46+
})
47+
```
48+
49+
### toNotDispatchActionsWithState
50+
51+
> `toNotDispatchActionsWithState(initialState, action, expectedActions, done, fail)`
52+
53+
Same as `toNotDispatchActions` + asserts that store initialised with `state` before `action` is dispatched.
54+
55+
```js
56+
test('Thunk: editTag', (t) => {
57+
toNotDispatchActions({property: 'value'}, testActionCreator(), [{ type: 'MY_ACTION_START' }], t.pass, t.fail);
58+
})
59+
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"mocha": "^2.4.5",
3939
"redux-thunk": "^2.1.0",
4040
"rimraf": "^2.5.2",
41-
"should": "^8.3.2"
41+
"should": "^8.3.2",
42+
"tape": "^4.6.0"
4243
},
4344
"dependencies": {
4445
"redux-actions-assertions-js": "^1.1.0"

test/tape/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import tape from 'tape'
2+
import thunk from 'redux-thunk';
3+
4+
import { registerMiddlewares } from '../../src';
5+
import { registerAssertions } from '../../src/should';
6+
import actions from '../testingData/actions';
7+
8+
registerMiddlewares([thunk]);
9+
registerAssertions();
10+
11+
describe('tape', () => {
12+
describe('', () => {
13+
it('', (done) => {
14+
done()
15+
})
16+
});
17+
});

0 commit comments

Comments
 (0)