Skip to content

Commit 88b15ff

Browse files
Move test utils inside the input_control_vis (#55169) (#55526)
* Move test utils to an appropriate folder * Change imports Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 83078a7 commit 88b15ff

File tree

11 files changed

+34
-15
lines changed

11 files changed

+34
-15
lines changed

src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import React from 'react';
2121
import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
2222
// @ts-ignore
2323
import { findTestSubject } from '@elastic/eui/lib/test';
24-
import { getDepsMock } from './__tests__/get_deps_mock';
25-
import { getIndexPatternMock } from './__tests__/get_index_pattern_mock';
24+
import { getDepsMock, getIndexPatternMock } from '../../test_utils';
2625
import { ControlsTab, ControlsTabUiProps } from './controls_tab';
2726

2827
const indexPatternsMock = {

src/legacy/core_plugins/input_control_vis/public/components/editor/list_control_editor.test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ import { shallow } from 'enzyme';
2525
import { findTestSubject } from '@elastic/eui/lib/test';
2626

2727
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
28-
import { getDepsMock } from './__tests__/get_deps_mock';
29-
import { getIndexPatternMock } from './__tests__/get_index_pattern_mock';
28+
import { getIndexPatternMock } from '../../test_utils/get_index_pattern_mock';
3029
import { ListControlEditor } from './list_control_editor';
3130
import { ControlParams } from '../../editor_utils';
32-
import { updateComponent } from './__tests__/update_component';
31+
import { getDepsMock, updateComponent } from '../../test_utils';
3332

3433
const controlParamsBase: ControlParams = {
3534
id: '1',

src/legacy/core_plugins/input_control_vis/public/components/editor/range_control_editor.test.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers';
2424

2525
// @ts-ignore
2626
import { findTestSubject } from '@elastic/eui/lib/test';
27-
import { getIndexPatternMock } from './__tests__/get_index_pattern_mock';
2827

2928
import { RangeControlEditor } from './range_control_editor';
3029
import { ControlParams } from '../../editor_utils';
31-
import { getDepsMock } from './__tests__/get_deps_mock';
32-
import { updateComponent } from './__tests__/update_component';
30+
import { getDepsMock } from '../../test_utils/get_deps_mock';
31+
import { getIndexPatternMock, updateComponent } from '../../test_utils';
3332

3433
const controlParams: ControlParams = {
3534
id: '1',

src/legacy/core_plugins/input_control_vis/public/control/list_control_factory.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
import { listControlFactory, ListControl } from './list_control_factory';
2121
import { ControlParams, CONTROL_TYPES } from '../editor_utils';
22-
import { getDepsMock } from '../components/editor/__tests__/get_deps_mock';
23-
import { getSearchSourceMock } from '../components/editor/__tests__/get_search_service_mock';
22+
import { getDepsMock, getSearchSourceMock } from '../test_utils';
2423

2524
const MockSearchSource = getSearchSourceMock();
2625
const deps = getDepsMock();

src/legacy/core_plugins/input_control_vis/public/control/range_control_factory.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
import { rangeControlFactory } from './range_control_factory';
2121
import { ControlParams, CONTROL_TYPES } from '../editor_utils';
22-
import { getSearchSourceMock } from '../components/editor/__tests__/get_search_service_mock';
23-
import { getDepsMock } from '../components/editor/__tests__/get_deps_mock';
22+
import { getDepsMock, getSearchSourceMock } from '../test_utils';
2423

2524
const deps = getDepsMock();
2625

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import React from 'react';
2121
import { FieldList } from 'src/plugins/data/public';
22-
import { InputControlVisDependencies } from '../../../plugin';
22+
import { InputControlVisDependencies } from '../plugin';
2323

2424
const fields: FieldList = [] as any;
2525
fields.push({ name: 'myField' } as any);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { IIndexPattern } from '../../../../../../../plugins/data/public';
20+
import { IIndexPattern } from 'src/plugins/data/public';
2121

2222
/**
2323
* Returns forced **Partial** IndexPattern for use in tests
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { SearchSource } from '../../../legacy_imports';
20+
import { SearchSource } from '../legacy_imports';
2121

2222
export const getSearchSourceMock = (esSearchResponse?: any): SearchSource =>
2323
jest.fn().mockImplementation(() => ({
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export { getDepsMock } from './get_deps_mock';
21+
export { getIndexPatternMock } from './get_index_pattern_mock';
22+
export { getIndexPatternsMock } from './get_index_patterns_mock';
23+
export { getSearchSourceMock } from './get_search_service_mock';
24+
export { updateComponent } from './update_component';

0 commit comments

Comments
 (0)