mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-01-31 11:51:41 +03:00
maxAge should throw error when < 2
This commit is contained in:
parent
275f564c54
commit
25eab60562
|
@ -411,6 +411,15 @@ function unliftStore(liftedStore, liftReducer) {
|
|||
* Redux instrumentation store enhancer.
|
||||
*/
|
||||
export default function instrument(monitorReducer = () => null, options = {}) {
|
||||
/* eslint-disable no-eq-null */
|
||||
if (options.maxAge != null && options.maxAge < 2) {
|
||||
/* eslint-enable */
|
||||
throw new Error(
|
||||
'DevTools.instrument({ maxAge }) option, if specified, ' +
|
||||
'may not be less than 2.'
|
||||
);
|
||||
}
|
||||
|
||||
return createStore => (reducer, initialState, enhancer) => {
|
||||
|
||||
function liftReducer(r) {
|
||||
|
|
|
@ -479,6 +479,12 @@ describe('instrument', () => {
|
|||
|
||||
spy.restore();
|
||||
});
|
||||
|
||||
it('should throw error when maxAge < 2', () => {
|
||||
expect(() => {
|
||||
createStore(counter, instrument(undefined, { maxAge: 1 }));
|
||||
}).toThrow(/may not be less than 2/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Import State', () => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user