redux-actions-assertions
Version:
Assertions for redux actions testing
43 lines (33 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.registerAssertions = undefined;
var _expect = require('expect');
var _expect2 = _interopRequireDefault(_expect);
var _reduxActionsAssertionsJs = require('redux-actions-assertions-js');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function withState(state) {
this.state = state;
return this;
}
function toDispatchActions(expectedActions, done) {
if (this.state) {
return _reduxActionsAssertionsJs.assertions.toDispatchActionsWithState(this.state, this.actual, expectedActions, done);
}
return _reduxActionsAssertionsJs.assertions.toDispatchActions(this.actual, expectedActions, done);
}
function toNotDispatchActions(expectedActions, done) {
if (this.state) {
return _reduxActionsAssertionsJs.assertions.toNotDispatchActionsWithState(this.state, this.actual, expectedActions, done);
}
return _reduxActionsAssertionsJs.assertions.toNotDispatchActions(this.actual, expectedActions, done);
}
function registerAssertions() {
_expect2.default.extend({
toDispatchActions: toDispatchActions,
toNotDispatchActions: toNotDispatchActions,
withState: withState
});
}
exports.registerAssertions = registerAssertions;