chore: Adds QueryParamProvider to testing helper (#14195)

This commit is contained in:
Michael S. Molina 2021-05-06 01:58:40 -03:00 committed by GitHub
parent fa0915d9e6
commit fa510df624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -26,16 +26,19 @@ import thunk from 'redux-thunk';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import reducerIndex from 'spec/helpers/reducerIndex';
import { QueryParamProvider } from 'use-query-params';
type Options = Omit<RenderOptions, 'queries'> & {
useRedux?: boolean;
useDnd?: boolean;
useQueryParams?: boolean;
initialState?: {};
reducers?: {};
};
function createWrapper(options?: Options) {
const { useDnd, useRedux, initialState, reducers } = options || {};
const { useDnd, useRedux, useQueryParams, initialState, reducers } =
options || {};
return ({ children }: { children?: ReactNode }) => {
let result = (
@ -56,6 +59,10 @@ function createWrapper(options?: Options) {
result = <Provider store={store}>{result}</Provider>;
}
if (useQueryParams) {
result = <QueryParamProvider>{result}</QueryParamProvider>;
}
return result;
};
}