fix tests with search updates

This commit is contained in:
John Mitchell
2019-09-13 14:45:26 -04:00
parent 34e1b8be1d
commit 678fba1ffb
9 changed files with 127 additions and 20 deletions

View File

@@ -5,6 +5,13 @@ import Search from './Search';
describe('<Search />', () => {
let search;
const QS_CONFIG = {
namespace: 'organization',
dateFields: [ 'modified', 'created' ],
defaultParams: { page: 1, page_size: 5, order_by: 'name' },
integerFields: ['page', 'page_size'],
};
afterEach(() => {
if (search) {
search = null;
@@ -22,7 +29,7 @@ describe('<Search />', () => {
const onSearch = jest.fn();
search = mountWithContexts(
<Search sortedColumnKey="name" columns={columns} onSearch={onSearch} />
<Search qsConfig={QS_CONFIG} sortedColumnKey="name" columns={columns} onSearch={onSearch} />
);
search.find(searchTextInput).instance().value = 'test-321';
@@ -39,7 +46,7 @@ describe('<Search />', () => {
];
const onSearch = jest.fn();
const wrapper = mountWithContexts(
<Search sortedColumnKey="name" columns={columns} onSearch={onSearch} />
<Search qsConfig={QS_CONFIG} sortedColumnKey="name" columns={columns} onSearch={onSearch} />
).find('Search');
expect(wrapper.state('isSearchDropdownOpen')).toEqual(false);
wrapper.instance().handleDropdownToggle(true);
@@ -58,7 +65,7 @@ describe('<Search />', () => {
];
const onSearch = jest.fn();
const wrapper = mountWithContexts(
<Search sortedColumnKey="name" columns={columns} onSearch={onSearch} />
<Search qsConfig={QS_CONFIG} sortedColumnKey="name" columns={columns} onSearch={onSearch} />
).find('Search');
expect(wrapper.state('searchKey')).toEqual('name');
wrapper