mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
test: show array param decoder (#5955)
This commit is contained in:
parent
22037cb0f2
commit
b00909db3f
@ -3,7 +3,7 @@ import { screen, waitFor } from '@testing-library/react';
|
|||||||
import { usePersistentTableState } from './usePersistentTableState';
|
import { usePersistentTableState } from './usePersistentTableState';
|
||||||
import { Route, Routes } from 'react-router-dom';
|
import { Route, Routes } from 'react-router-dom';
|
||||||
import { createLocalStorage } from '../utils/createLocalStorage';
|
import { createLocalStorage } from '../utils/createLocalStorage';
|
||||||
import { NumberParam, StringParam } from 'use-query-params';
|
import { ArrayParam, NumberParam, StringParam } from 'use-query-params';
|
||||||
import { FilterItemParam } from '../utils/serializeQueryParams';
|
import { FilterItemParam } from '../utils/serializeQueryParams';
|
||||||
|
|
||||||
type TestComponentProps = {
|
type TestComponentProps = {
|
||||||
@ -87,6 +87,7 @@ describe('usePersistentTableState', () => {
|
|||||||
createLocalStorage('testKey', {}).setValue({
|
createLocalStorage('testKey', {}).setValue({
|
||||||
query: 'initialStorage',
|
query: 'initialStorage',
|
||||||
filterItem: { operator: 'IS', values: ['default'] },
|
filterItem: { operator: 'IS', values: ['default'] },
|
||||||
|
columns: ['a', 'b'],
|
||||||
});
|
});
|
||||||
|
|
||||||
render(
|
render(
|
||||||
@ -95,6 +96,7 @@ describe('usePersistentTableState', () => {
|
|||||||
queryParamsDefinition={{
|
queryParamsDefinition={{
|
||||||
query: StringParam,
|
query: StringParam,
|
||||||
filterItem: FilterItemParam,
|
filterItem: FilterItemParam,
|
||||||
|
columns: ArrayParam,
|
||||||
}}
|
}}
|
||||||
/>,
|
/>,
|
||||||
{ route: '/my-url' },
|
{ route: '/my-url' },
|
||||||
@ -104,7 +106,7 @@ describe('usePersistentTableState', () => {
|
|||||||
'initialStorage',
|
'initialStorage',
|
||||||
);
|
);
|
||||||
expect(window.location.href).toContain(
|
expect(window.location.href).toContain(
|
||||||
'my-url?query=initialStorage&filterItem=IS%3Adefault',
|
'my-url?query=initialStorage&filterItem=IS%3Adefault&columns=a&columns=b',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user