mirror of https://github.com/apache/superset.git
chore: Adds QueryParamProvider to testing helper (#14195)
This commit is contained in:
parent
fa0915d9e6
commit
fa510df624
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue