redux-testkit
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,40 +0,73 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.createMiddleware=createMiddleware;function _asyncToGenerator(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){function step(key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{return Promise.resolve(value).then(function(value){step("next",value);},function(err){step("throw",err);});}}return step("next");});};}function createMiddleware(){var _this=this; | ||
var pendingPromises=[]; | ||
'use strict'; | ||
var middleware=function middleware(){ | ||
return function(next){return function(action){ | ||
var returnValue=void 0; | ||
if(typeof action==='function'){ | ||
var actionWrapper=function actionWrapper(){ | ||
var result=action.apply(undefined,arguments); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createMiddleware = createMiddleware; | ||
if(result&&result.then&&typeof result.then==='function'){ | ||
pendingPromises.push(result); | ||
} | ||
return result; | ||
}; | ||
returnValue=next(actionWrapper); | ||
}else{ | ||
returnValue=next(action); | ||
} | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
return returnValue; | ||
};}; | ||
}; | ||
function createMiddleware() { | ||
var _this = this; | ||
middleware.flush=_asyncToGenerator(regeneratorRuntime.mark(function _callee(){var promisesCount;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0: | ||
promisesCount=pendingPromises.length;if(!( | ||
promisesCount>0)){_context.next=7;break;}_context.next=4;return( | ||
Promise.all(pendingPromises));case 4: | ||
var pendingPromises = []; | ||
pendingPromises=pendingPromises.slice(promisesCount);_context.next=7;return( | ||
middleware.flush());case 7:case'end':return _context.stop();}}},_callee,_this);})); | ||
var middleware = function middleware() { | ||
return function (next) { | ||
return function (action) { | ||
var returnValue = void 0; | ||
if (typeof action === 'function') { | ||
var actionWrapper = function actionWrapper() { | ||
var result = action.apply(undefined, arguments); | ||
if (result && result.then && typeof result.then === 'function') { | ||
pendingPromises.push(result); | ||
} | ||
return result; | ||
}; | ||
returnValue = next(actionWrapper); | ||
} else { | ||
returnValue = next(action); | ||
} | ||
return returnValue; | ||
}; | ||
}; | ||
}; | ||
middleware.reset=function(){ | ||
pendingPromises=[]; | ||
}; | ||
middleware.flush = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { | ||
var promisesCount; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
promisesCount = pendingPromises.length; | ||
return middleware; | ||
if (!(promisesCount > 0)) { | ||
_context.next = 7; | ||
break; | ||
} | ||
_context.next = 4; | ||
return Promise.all(pendingPromises); | ||
case 4: | ||
// remove resolved promises | ||
pendingPromises = pendingPromises.slice(promisesCount); | ||
_context.next = 7; | ||
return middleware.flush(); | ||
case 7: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, _this); | ||
})); | ||
middleware.reset = function () { | ||
pendingPromises = []; | ||
}; | ||
return middleware; | ||
} |
@@ -1,11 +0,23 @@ | ||
'use strict';var _Reducer=require('./Reducer');var _Reducer2=_interopRequireDefault(_Reducer); | ||
var _Selector=require('./Selector');var _Selector2=_interopRequireDefault(_Selector); | ||
var _Thunk=require('./Thunk');var _Thunk2=_interopRequireDefault(_Thunk); | ||
var _FlushThunks=require('./FlushThunks');var FlushThunks=_interopRequireWildcard(_FlushThunks); | ||
'use strict'; | ||
var _Reducer = require('./Reducer'); | ||
var _ActionTest=require('./ActionTest'); | ||
var _ReducerTest=require('./ReducerTest'); | ||
var _WaitForAsyncsMiddleware=require('./WaitForAsyncsMiddleware');var WaitForAsyncsMiddleware=_interopRequireWildcard(_WaitForAsyncsMiddleware);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};} | ||
var _Reducer2 = _interopRequireDefault(_Reducer); | ||
module.exports={Reducer:_Reducer2.default,Selector:_Selector2.default,Thunk:_Thunk2.default,FlushThunks:FlushThunks,ActionTest:_ActionTest.ActionTest,ReducerTest:_ReducerTest.ReducerTest,WaitForAsyncsMiddleware:WaitForAsyncsMiddleware}; | ||
var _Selector = require('./Selector'); | ||
var _Selector2 = _interopRequireDefault(_Selector); | ||
var _Thunk = require('./Thunk'); | ||
var _Thunk2 = _interopRequireDefault(_Thunk); | ||
var _FlushThunks = require('./FlushThunks'); | ||
var FlushThunks = _interopRequireWildcard(_FlushThunks); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
module.exports = { Reducer: _Reducer2.default, Selector: _Selector2.default, Thunk: _Thunk2.default, FlushThunks: FlushThunks }; |
@@ -1,58 +0,80 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.default= | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports.default = function (reducer) { | ||
var defaultInitialState = reducer(undefined, {}); | ||
function internalReducerCommands(initialState) { | ||
return { | ||
expect: function (_expect) { | ||
function expect(_x) { | ||
return _expect.apply(this, arguments); | ||
} | ||
expect.toString = function () { | ||
return _expect.toString(); | ||
}; | ||
return expect; | ||
}(function (action) { | ||
var originalState = _lodash2.default.cloneDeep(initialState); | ||
var newState = reducer(initialState, action); | ||
var mutated = !(0, _utils.deepEqual)(initialState, originalState); | ||
return { | ||
toReturnState: function toReturnState(expected) { | ||
expect(newState).toEqual(expected); | ||
// expect(mutated).toEqual(false); | ||
if (mutated) { | ||
throw new Error('state mutated after running reducer'); | ||
} | ||
}, | ||
toChangeInState: function toChangeInState(expectedChanges) { | ||
var expected = _lodash2.default.mergeWith(originalState, expectedChanges, toChangeInStateCustomizer); | ||
expect(newState).toEqual(expected); | ||
// expect(mutated).toEqual(false); | ||
if (mutated) { | ||
throw new Error('state mutated after running reducer'); | ||
} | ||
} | ||
}; | ||
}), | ||
execute: function execute(action) { | ||
var originalState = _lodash2.default.cloneDeep(initialState); | ||
var newState = reducer(initialState, action); | ||
var mutated = !(0, _utils.deepEqual)(initialState, originalState); | ||
if (mutated) { | ||
throw new Error('state mutated after running reducer'); | ||
} | ||
return newState; | ||
} | ||
}; | ||
} | ||
return _extends({ | ||
withState: function withState(state) { | ||
var initialState = state || defaultInitialState; | ||
return internalReducerCommands(initialState); | ||
} | ||
}, internalReducerCommands(defaultInitialState)); | ||
}; | ||
function(reducer){ | ||
var defaultInitialState=reducer(undefined,{}); | ||
var _lodash = require('lodash'); | ||
function internalReducerCommands(initialState){ | ||
return{ | ||
expect:function(_expect){function expect(_x){return _expect.apply(this,arguments);}expect.toString=function(){return _expect.toString();};return expect;}(function(action){ | ||
var originalState=_lodash2.default.cloneDeep(initialState); | ||
var newState=reducer(initialState,action); | ||
var mutated=!(0,_utils.deepEqual)(initialState,originalState); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
return{ | ||
toReturnState:function toReturnState(expected){ | ||
expect(newState).toEqual(expected); | ||
var _utils = require('./utils'); | ||
if(mutated){ | ||
throw new Error('state mutated after running reducer'); | ||
} | ||
}, | ||
toChangeInState:function toChangeInState(expectedChanges){ | ||
var expected=_lodash2.default.mergeWith(originalState,expectedChanges,toChangeInStateCustomizer); | ||
expect(newState).toEqual(expected); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
if(mutated){ | ||
throw new Error('state mutated after running reducer'); | ||
} | ||
}}; | ||
}), | ||
execute:function execute(action){ | ||
var originalState=_lodash2.default.cloneDeep(initialState); | ||
var newState=reducer(initialState,action); | ||
var mutated=!(0,_utils.deepEqual)(initialState,originalState); | ||
if(mutated){ | ||
throw new Error('state mutated after running reducer'); | ||
} | ||
return newState; | ||
}}; | ||
} | ||
return _extends({ | ||
withState:function withState(state){ | ||
var initialState=state||defaultInitialState; | ||
return internalReducerCommands(initialState); | ||
}}, | ||
internalReducerCommands(defaultInitialState)); | ||
};var _lodash=require('lodash');var _lodash2=_interopRequireDefault(_lodash);var _utils=require('./utils');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function toChangeInStateCustomizer(objValue,srcValue){if(_lodash2.default.isArray(objValue)){return srcValue;}return undefined;} | ||
function toChangeInStateCustomizer(objValue, srcValue) { | ||
if (_lodash2.default.isArray(objValue)) { | ||
return srcValue; | ||
} | ||
return undefined; | ||
} |
@@ -1,31 +0,60 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default= | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function(selector){ | ||
return{ | ||
expect:function(_expect){function expect(_x){return _expect.apply(this,arguments);}expect.toString=function(){return _expect.toString();};return expect;}(function(state){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];} | ||
var originalState=_lodash2.default.cloneDeep(state); | ||
var result=selector.apply(undefined,[state].concat(args)); | ||
var mutated=!(0,_utils.deepEqual)(state,originalState); | ||
exports.default = function (selector) { | ||
return { | ||
expect: function (_expect) { | ||
function expect(_x) { | ||
return _expect.apply(this, arguments); | ||
} | ||
return{ | ||
toReturn:function toReturn(expected){ | ||
expect(result).toEqual(expected); | ||
expect.toString = function () { | ||
return _expect.toString(); | ||
}; | ||
if(mutated){ | ||
throw new Error('state mutated after running selector'); | ||
} | ||
}}; | ||
return expect; | ||
}(function (state) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
}), | ||
execute:function execute(state){for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];} | ||
var originalState=_lodash2.default.cloneDeep(state); | ||
var result=selector.apply(undefined,[state].concat(args)); | ||
var mutated=!(0,_utils.deepEqual)(state,originalState); | ||
if(mutated){ | ||
throw new Error('state mutated after running selector'); | ||
} | ||
return result; | ||
}}; | ||
var originalState = _lodash2.default.cloneDeep(state); | ||
var result = selector.apply(undefined, [state].concat(args)); | ||
var mutated = !(0, _utils.deepEqual)(state, originalState); | ||
};var _lodash=require('lodash');var _lodash2=_interopRequireDefault(_lodash);var _utils=require('./utils');function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};} | ||
return { | ||
toReturn: function toReturn(expected) { | ||
expect(result).toEqual(expected); | ||
// expect(mutated).toEqual(false); | ||
if (mutated) { | ||
throw new Error('state mutated after running selector'); | ||
} | ||
} | ||
}; | ||
}), | ||
execute: function execute(state) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
} | ||
var originalState = _lodash2.default.cloneDeep(state); | ||
var result = selector.apply(undefined, [state].concat(args)); | ||
var mutated = !(0, _utils.deepEqual)(state, originalState); | ||
if (mutated) { | ||
throw new Error('state mutated after running selector'); | ||
} | ||
return result; | ||
} | ||
}; | ||
}; | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _utils = require('./utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,81 +0,187 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};var dispatch=function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark( | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var dispatch = function () { | ||
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(action) { | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!_lodash2.default.isFunction(action) && !_lodash2.default.isPlainObject(action)) { | ||
error = new Error('unsupported ' + action + ' action type sent to dispatch'); | ||
} | ||
dispatches.push(createDispatchedObject(action)); | ||
case 2: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
return function dispatch(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
var executeDispatch = function () { | ||
var _ref2 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(action) { | ||
var result; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
if (!_lodash2.default.isFunction(action)) { | ||
_context2.next = 5; | ||
break; | ||
} | ||
_context2.next = 3; | ||
return action(dispatch, getState); | ||
case 3: | ||
result = _context2.sent; | ||
return _context2.abrupt('return', Promise.resolve(result)); | ||
case 5: | ||
error = new Error('provided action is not a thunk function'); | ||
return _context2.abrupt('return', null); | ||
case 7: | ||
case 'end': | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
return function executeDispatch(_x2) { | ||
return _ref2.apply(this, arguments); | ||
}; | ||
}(); | ||
exports.default = function (thunkFunction) { | ||
dispatches = []; | ||
error = undefined; | ||
state = undefined; | ||
originalState = undefined; | ||
function internalThunkCommands() { | ||
var _this = this; | ||
return { | ||
execute: function () { | ||
var _ref3 = _asyncToGenerator(regeneratorRuntime.mark(function _callee3() { | ||
return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
if (!_lodash2.default.isFunction(thunkFunction)) { | ||
_context3.next = 6; | ||
break; | ||
} | ||
_context3.next = 3; | ||
return executeDispatch(thunkFunction()); | ||
case 3: | ||
checkForStateMutation(); | ||
_context3.next = 7; | ||
break; | ||
case 6: | ||
error = new Error('you must pass a thunk function to Thunk()'); | ||
case 7: | ||
if (!error) { | ||
_context3.next = 9; | ||
break; | ||
} | ||
function _callee(action){return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0: | ||
if(!_lodash2.default.isFunction(action)&&!_lodash2.default.isPlainObject(action)){ | ||
error=new Error('unsupported '+action+' action type sent to dispatch'); | ||
} | ||
throw error; | ||
dispatches.push(createDispatchedObject(action));case 2:case'end':return _context.stop();}}},_callee,this);}));return function dispatch(_x){return _ref.apply(this,arguments);};}();var executeDispatch=function(){var _ref2=_asyncToGenerator(regeneratorRuntime.mark( | ||
case 9: | ||
return _context3.abrupt('return', dispatches); | ||
case 10: | ||
case 'end': | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3, _this); | ||
})); | ||
function _callee2(action){var result;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(! | ||
_lodash2.default.isFunction(action)){_context2.next=5;break;}_context2.next=3;return( | ||
action(dispatch,getState));case 3:result=_context2.sent;return _context2.abrupt('return', | ||
Promise.resolve(result));case 5: | ||
return function execute() { | ||
return _ref3.apply(this, arguments); | ||
}; | ||
}() | ||
}; | ||
} | ||
return _extends({ | ||
withState: function withState(storeState) { | ||
state = storeState; | ||
originalState = _lodash2.default.cloneDeep(storeState); | ||
return internalThunkCommands(); | ||
} | ||
}, internalThunkCommands()); | ||
}; | ||
error=new Error('provided action is not a thunk function');return _context2.abrupt('return', | ||
null);case 7:case'end':return _context2.stop();}}},_callee2,this);}));return function executeDispatch(_x2){return _ref2.apply(this,arguments);};}();exports.default= | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _utils = require('./utils'); | ||
var utils = _interopRequireWildcard(_utils); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
var dispatches = []; | ||
var state = void 0; | ||
var originalState = void 0; | ||
var error = void 0; | ||
function createDispatchedObject(action) { | ||
return { | ||
isFunction: function isFunction() { | ||
return _lodash2.default.isFunction(action); | ||
}, | ||
isPlainObject: function isPlainObject() { | ||
return _lodash2.default.isPlainObject(action); | ||
}, | ||
getType: function getType() { | ||
return _lodash2.default.get(action, 'type'); | ||
}, | ||
getAction: function getAction() { | ||
return action; | ||
}, | ||
getName: function getName() { | ||
return _lodash2.default.get(action, 'name'); | ||
} | ||
}; | ||
} | ||
function(thunkFunction){ | ||
dispatches=[]; | ||
error=undefined; | ||
state=undefined; | ||
originalState=undefined; | ||
function internalThunkCommands(){var _this=this; | ||
return{ | ||
execute:function(){var _ref3=_asyncToGenerator(regeneratorRuntime.mark(function _callee3(){return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:if(! | ||
_lodash2.default.isFunction(thunkFunction)){_context3.next=6;break;}_context3.next=3;return( | ||
executeDispatch(thunkFunction()));case 3: | ||
checkForStateMutation();_context3.next=7;break;case 6: | ||
error=new Error('you must pass a thunk function to Thunk()');case 7:if(! | ||
error){_context3.next=9;break;}throw( | ||
error);case 9:return _context3.abrupt('return', | ||
dispatches);case 10:case'end':return _context3.stop();}}},_callee3,_this);}));function execute(){return _ref3.apply(this,arguments);}return execute;}()}; | ||
function getState() { | ||
return state; | ||
} | ||
return _extends({ | ||
withState:function withState(storeState){ | ||
state=storeState; | ||
originalState=_lodash2.default.cloneDeep(storeState); | ||
return internalThunkCommands(); | ||
}}, | ||
internalThunkCommands()); | ||
function checkForStateMutation() { | ||
var mutated = !utils.deepEqual(state, originalState); | ||
};var _lodash=require('lodash');var _lodash2=_interopRequireDefault(_lodash);var _utils=require('./utils');var utils=_interopRequireWildcard(_utils);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _asyncToGenerator(fn){return function(){var gen=fn.apply(this,arguments);return new Promise(function(resolve,reject){function step(key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{return Promise.resolve(value).then(function(value){step("next",value);},function(err){step("throw",err);});}}return step("next");});};}var dispatches=[];var state=void 0;var originalState=void 0;var error=void 0;function createDispatchedObject(action){return{isFunction:function isFunction(){return _lodash2.default.isFunction(action);},isPlainObject:function isPlainObject(){return _lodash2.default.isPlainObject(action);},getType:function getType(){return _lodash2.default.get(action,'type');},getAction:function getAction(){return action;},getName:function getName(){return _lodash2.default.get(action,'name');}};}function getState(){return state;}function checkForStateMutation(){var mutated=!utils.deepEqual(state,originalState);if(mutated){error=new Error('state mutated after running the thunk');}} | ||
if (mutated) { | ||
error = new Error('state mutated after running the thunk'); | ||
} | ||
} |
@@ -1,23 +0,32 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _typeof=typeof Symbol==="function"&&typeof(typeof Symbol==="function"?Symbol.iterator:"@@iterator")==="symbol"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==(typeof Symbol==="function"?Symbol.prototype:"@@prototype")?"symbol":typeof obj;};exports.deepEqual=deepEqual;function deepEqual(x,y){ | ||
if((typeof x==="undefined"?"undefined":_typeof(x))==="object"&&x!==null&&(typeof y==="undefined"?"undefined":_typeof(y))==="object"&&y!==null){ | ||
if(Object.keys(x).length!==Object.keys(y).length){ | ||
return false; | ||
} | ||
"use strict"; | ||
for(var prop in x){ | ||
if(y.hasOwnProperty(prop)){ | ||
if(!deepEqual(x[prop],y[prop])){ | ||
return false; | ||
} | ||
}else{ | ||
return false; | ||
} | ||
} | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
return true; | ||
}else if(x!==y){ | ||
return false; | ||
}else{ | ||
return true; | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.deepEqual = deepEqual; | ||
function deepEqual(x, y) { | ||
if ((typeof x === "undefined" ? "undefined" : _typeof(x)) === "object" && x !== null && (typeof y === "undefined" ? "undefined" : _typeof(y)) === "object" && y !== null) { | ||
if (Object.keys(x).length !== Object.keys(y).length) { | ||
return false; | ||
} | ||
for (var prop in x) { | ||
if (y.hasOwnProperty(prop)) { | ||
if (!deepEqual(x[prop], y[prop])) { | ||
return false; | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} else if (x !== y) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} |
{ | ||
"name": "redux-testkit", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"publishConfig": { | ||
@@ -16,3 +16,3 @@ "registry": "https://registry.npmjs.org/" | ||
"scripts": { | ||
"build": "rm -rf dist && babel src --presets react-native -d dist", | ||
"build": "rm -rf dist && babel src --presets=stage-0,latest,react -d dist", | ||
"lint": "eslint src test", | ||
@@ -24,4 +24,3 @@ "pretest": "npm run lint", | ||
"dependencies": { | ||
"lodash": "^4.0.0", | ||
"deasync": "^0.1.7" | ||
"lodash": "^4.0.0" | ||
}, | ||
@@ -28,0 +27,0 @@ "devDependencies": { |
@@ -6,7 +6,2 @@ import Reducer from './Reducer'; | ||
// deprecated | ||
import {ActionTest} from './ActionTest'; | ||
import {ReducerTest} from './ReducerTest'; | ||
import * as WaitForAsyncsMiddleware from './WaitForAsyncsMiddleware'; | ||
module.exports = {Reducer, Selector, Thunk, FlushThunks, ActionTest, ReducerTest, WaitForAsyncsMiddleware}; | ||
module.exports = {Reducer, Selector, Thunk, FlushThunks}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
194313
21
599
1
- Removeddeasync@^0.1.7
- Removedbindings@1.5.0(transitive)
- Removeddeasync@0.1.30(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removednode-addon-api@1.7.2(transitive)