diff options
Diffstat (limited to 'app/utils/checkStore.js')
-rw-r--r-- | app/utils/checkStore.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/utils/checkStore.js b/app/utils/checkStore.js new file mode 100644 index 0000000..fa12d27 --- /dev/null +++ b/app/utils/checkStore.js @@ -0,0 +1,24 @@ +import conformsTo from 'lodash/conformsTo'; +import isFunction from 'lodash/isFunction'; +import isObject from 'lodash/isObject'; +import invariant from 'invariant'; + +/** + * Validate the shape of redux store + */ +export default function checkStore(store) { + const shape = { + dispatch: isFunction, + subscribe: isFunction, + getState: isFunction, + replaceReducer: isFunction, + addEpic: isFunction, + epicStopper: isFunction, + injectedReducers: isObject, + injectedEpics: isObject, + }; + invariant( + conformsTo(store, shape), + '(app/utils...) injectors: Expected a valid redux store', + ); +} |