enzyme-redux
Version:
Test utils to simplify testing of containers in redux with enzyme.
56 lines (50 loc) • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mountWithState = exports.shallowWithState = exports.mountWithStore = exports.shallowWithStore = undefined;
var _enzyme = require('enzyme');
var shallowWithStore = exports.shallowWithStore = function shallowWithStore(Component, store) {
var context = {
store: store
};
return (0, _enzyme.shallow)(Component, { context: context });
};
var mountWithStore = exports.mountWithStore = function mountWithStore(Component, store) {
var context = {
store: store
};
return (0, _enzyme.mount)(Component, { context: context });
};
var shallowWithState = exports.shallowWithState = function shallowWithState(Component, state) {
var context = {
store: {
getState: function getState() {
return state;
},
subscribe: function subscribe() {
return {};
},
dispatch: function dispatch() {
return {};
}
}
};
return (0, _enzyme.shallow)(Component, { context: context });
};
var mountWithState = exports.mountWithState = function mountWithState(Component, state) {
var context = {
store: {
getState: function getState() {
return state;
},
subscribe: function subscribe() {
return {};
},
dispatch: function dispatch() {
return {};
}
}
};
return (0, _enzyme.mount)(Component, { context: context });
};