Skip to content

Commit

Permalink
[CCI] Fix EUI/OUI type errors (opensearch-project#3798)
Browse files Browse the repository at this point in the history
* Update find_test_subject imports for tests

Signed-off-by: Alexei Karikov <[email protected]>

* Update to available imports for findTestSubject

Signed-off-by: Alexei Karikov <[email protected]>

* Fix available import for Query and custom icon

Signed-off-by: Alexei Karikov <[email protected]>

* Add changelog entry

Signed-off-by: Alexei Karikov <[email protected]>

* Add ts-ignore

Signed-off-by: Alexei Karikov <[email protected]>

---------

Signed-off-by: Alexei Karikov <[email protected]>
Co-authored-by: Qingyang(Abby) Hu <[email protected]>
  • Loading branch information
Nicksqain and abbyhu2000 authored May 15, 2023
1 parent 8121c9d commit 0e25f2e
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Console] Replace jQuery.ajax with core.http when calling OSD APIs in console ([#3080](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3080))
- [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629))
- [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693))
- Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798))

### 🔩 Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { FieldSetting } from '../../types';
import { UiSettingsType, StringValidation } from '../../../../../../core/public';
import { notificationServiceMock, docLinksServiceMock } from '../../../../../../core/public/mocks';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { Field, getEditableValue } from './field';

jest.mock('brace/theme/textmate', () => 'brace/theme/textmate');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';
import { UiSettingsType } from '../../../../../../core/public';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

import { notificationServiceMock } from '../../../../../../core/public/mocks';
import { SettingsChanges } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { shallowWithI18nProvider, mountWithI18nProvider } from 'test_utils/enzyme_helpers';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

import { Query } from '@elastic/eui';
import { Search } from './search';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import React, { Fragment, PureComponent } from 'react';
import { i18n } from '@osd/i18n';
import { EuiSearchBar, EuiFormErrorText, Query } from '@elastic/eui';

import { getCategoryName } from '../../lib';

interface SearchProps {
Expand Down Expand Up @@ -111,6 +110,7 @@ export class Search extends PureComponent<SearchProps> {

return (
<Fragment>
{/* @ts-ignore The Query types that typescript complains about here are identical and is a false flag. Once OUI migration is complete, this ignore can be removed */}
<EuiSearchBar box={box} filters={filters} onChange={this.onChange} query={query} />
{queryParseError}
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { coreMock } from '../../../../core/public/mocks';

describe('DashboardEmptyScreen', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* under the License.
*/

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import React from 'react';
import { mount } from 'enzyme';
import { nextTick } from 'test_utils/enzyme_helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers';
import ShardFailureOpenModalButton from './shard_failure_open_modal_button';
import { shardFailureRequest } from './__mocks__/shard_failure_request';
import { shardFailureResponse } from './__mocks__/shard_failure_response';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

describe('ShardFailureOpenModalButton', () => {
it('triggers the openModal function when "Show details" button is clicked', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dev_tools/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> {
defaultMessage: 'Dev Tools',
}),
updater$: this.appStateUpdater,
euiIconType: '/plugins/home/assets/logos/opensearch_mark_default.svg',
icon: '/plugins/home/public/assets/logos/opensearch_mark_default.svg',
order: 9010,
category: DEFAULT_APP_CATEGORIES.management,
mount: async (params: AppMountParameters) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ActionBar, ActionBarProps } from './action_bar';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE } from '../../query_parameters/constants';

describe('Test Discover Context ActionBar for successor | predecessor records', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { ToolBarPagerButtons } from './tool_bar_pager_buttons';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

test('it renders ToolBarPagerButtons', () => {
const props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { TableHeader } from './table_header';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { SortOrder } from './helpers';
import { IndexPattern, IFieldType } from '../../../../../opensearch_dashboards_services';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ReactWrapper } from 'enzyme';
import { ContextErrorMessage } from './context_error_message';
// @ts-ignore
import { FAILURE_REASONS, LOADING_STATUS } from '../../angular/context/query';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

describe('loading spinner', function () {
let component: ReactWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import React from 'react';
import { act } from 'react-dom/test-utils';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { Doc, DocProps } from './doc';

const mockSearchApi = jest.fn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import { DocViewer } from './doc_viewer';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { getDocViewsRegistry } from '../../../opensearch_dashboards_services';
import { DocViewRenderProps } from '../../doc_views/doc_views_types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { HitsCounter, HitsCounterProps } from './hits_counter';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

describe('hits counter', function () {
let props: HitsCounterProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { LoadingSpinner } from './loading_spinner';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

describe('loading spinner', function () {
let component: ReactWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { DiscoverFieldSearch, Props } from './discover_field_search';
import { EuiButtonGroupProps, EuiPopover } from '@elastic/eui';
import { ReactWrapper } from 'enzyme';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import _ from 'lodash';
import { ReactWrapper } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
// @ts-ignore
import realHits from 'fixtures/real_hits.js';
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import React from 'react';
import { mount } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { DocViewTable } from './table';
import { indexPatterns, IndexPattern } from '../../../../../data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { TimechartHeader, TimechartHeaderProps } from './timechart_header';
import { EuiIconTip } from '@elastic/eui';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

describe('timechart header', function () {
let props: TimechartHeaderProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import { HelloWorldEmbeddable } from '../../../../../../examples/embeddable_examples/public';
import { EmbeddableRoot } from './embeddable_root';
import { mount } from 'enzyme';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

test('EmbeddableRoot renders an embeddable', async () => {
const embeddable = new HelloWorldEmbeddable({ id: 'hello' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import { mount } from 'enzyme';
import { nextTick } from 'test_utils/enzyme_helpers';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { I18nProvider } from '@osd/i18n/react';
import { CONTEXT_MENU_TRIGGER } from '../triggers';
import { Action, UiActionsStart, ActionType } from '../../../../ui_actions/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ContainerInput } from '../../../../containers';
import { mountWithIntl as mount } from 'test_utils/enzyme_helpers';
import { ReactWrapper } from 'enzyme';
import { coreMock } from '../../../../../../../../core/public/mocks';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { embeddablePluginMock } from '../../../../../mocks';

function DummySavedObjectFinder(props: { children: React.ReactNode }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

import React from 'react';
import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';
import { getDepsMock, getIndexPatternMock } from '../../test_utils';
import { ControlsTab, ControlsTabUiProps } from './controls_tab';
import { Vis } from '../../../../visualizations/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { getIndexPatternMock } from '../../test_utils/get_index_pattern_mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { shallow } from 'enzyme';
import { SinonSpy, spy, assert } from 'sinon';
import { mountWithIntl } from 'test_utils/enzyme_helpers';

import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

import { RangeControlEditor } from './range_control_editor';
import { ControlParams } from '../../editor_utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { findTestSubject } from '@elastic/eui/lib/test';
import { findTestSubject } from 'test_utils/helpers';

import { InputControlVis } from './input_control_vis';
import { ListControl } from '../../control/list_control_factory';
Expand Down

0 comments on commit 0e25f2e

Please sign in to comment.