Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(NA): move uptime plugin tests out of __tests__ folder #87416

Merged
merged 3 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { combineFiltersAndUserSearch } from '../combine_filters_and_user_search';
import { combineFiltersAndUserSearch } from './combine_filters_and_user_search';

describe('combineFiltersAndUserSearch', () => {
it('returns only search if filters are empty', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getMLJobId } from '../ml';
import { getMLJobId } from './ml';

describe('ML Anomaly API', () => {
it('it generates a lowercase job id', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { stringifyKueries } from '../stringify_kueries';
import { stringifyKueries } from './stringify_kueries';

describe('stringifyKueries', () => {
let kueries: Map<string, number[] | string[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { CertMonitors } from '../cert_monitors';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { CertMonitors } from './cert_monitors';
import { renderWithRouter, shallowWithRouter } from '../../lib';

describe('CertMonitors', () => {
const certMons = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { CertificateSearch } from '../cert_search';
import { renderWithRouter, shallowWithRouter } from '../../lib';
import { CertificateSearch } from './cert_search';

describe('CertificatesSearch', () => {
it('shallow renders expected elements for valid props', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { CertStatus } from '../cert_status';
import { renderWithRouter, shallowWithRouter } from '../../lib';
import { CertStatus } from './cert_status';
import * as redux from 'react-redux';
import moment from 'moment';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { shallowWithRouter } from '../../../lib';
import { CertificateList, CertSort } from '../certificates_list';
import { shallowWithRouter } from '../../lib';
import { CertificateList, CertSort } from './certificates_list';

describe('CertificateList', () => {
it('shallow renders expected elements for valid props', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { FingerprintCol } from '../fingerprint_col';
import { renderWithRouter, shallowWithRouter } from '../../lib';
import { FingerprintCol } from './fingerprint_col';
import moment from 'moment';

describe('FingerprintCol', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ChartEmptyState } from '../chart_empty_state';
import { ChartEmptyState } from './chart_empty_state';
import { shallowWithIntl } from '@kbn/test/jest';
import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { EuiSpacer } from '@elastic/eui';
import { mount } from 'enzyme';
import { nextTick } from '@kbn/test/jest';
import { shallowWithIntl } from '@kbn/test/jest';
import { ChartWrapper } from '../chart_wrapper';
import { SnapshotHeading } from '../../../overview/snapshot/snapshot_heading';
import { DonutChart } from '../donut_chart';
import { ChartWrapper } from './chart_wrapper';
import { SnapshotHeading } from '../../overview/snapshot/snapshot_heading';
import { DonutChart } from './donut_chart';
const SNAPSHOT_CHART_HEIGHT = 144;
describe('ChartWrapper component', () => {
it('renders the component with loading false', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { DonutChart } from '../donut_chart';
import { DonutChart } from './donut_chart';
import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest';
import React from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import React from 'react';
import { renderWithIntl } from '@kbn/test/jest';

import { DonutChartLegend } from '../donut_chart_legend';
import { DonutChartLegend } from './donut_chart_legend';

import { STATUS_DOWN_LABEL, STATUS_UP_LABEL } from '../../translations';
import { STATUS_DOWN_LABEL, STATUS_UP_LABEL } from '../translations';

describe('DonutChartLegend', () => {
it('applies valid props as expected', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { DonutChartLegendRow } from '../donut_chart_legend_row';
import { DonutChartLegendRow } from './donut_chart_legend_row';
import { shallowWithIntl } from '@kbn/test/jest';
import React from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import React from 'react';
import DateMath from '@elastic/datemath';
import { DurationChartComponent } from '../duration_chart';
import { MonitorDurationResult } from '../../../../../common/types';
import { shallowWithRouter } from '../../../../lib';
import { DurationChartComponent } from './duration_chart';
import { MonitorDurationResult } from '../../../../common/types';
import { shallowWithRouter } from '../../../lib';

describe('MonitorCharts component', () => {
let dateMathSpy: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getTickFormat } from '../get_tick_format';
import { getTickFormat } from './get_tick_format';

describe('getTickFormat', () => {
it('returns null if value is NaN', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/

import React from 'react';
import { MonitorBarSeries, MonitorBarSeriesProps } from '../monitor_bar_series';
import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../../lib';
import { HistogramPoint } from '../../../../../common/runtime_types';
import { MonitorBarSeries, MonitorBarSeriesProps } from './monitor_bar_series';
import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../lib';
import { HistogramPoint } from '../../../../common/runtime_types';

describe('MonitorBarSeries component', () => {
let props: MonitorBarSeriesProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { PingHistogramComponent, PingHistogramComponentProps } from '../ping_histogram';
import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../../lib';
import { PingHistogramComponent, PingHistogramComponentProps } from './ping_histogram';
import { renderWithRouter, shallowWithRouter, MountWithReduxProvider } from '../../../lib';
import moment from 'moment';

describe('PingHistogram component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { getDateRangeFromChartElement } from '../utils';
import { getDateRangeFromChartElement } from './utils';
import { XYChartElementEvent } from '@elastic/charts';

describe('Chart utils', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import React from 'react';
import { PageHeader } from '../page_header';
import { renderWithRouter, MountWithReduxProvider } from '../../../../lib';
import { PageHeader } from './page_header';
import { renderWithRouter, MountWithReduxProvider } from '../../../lib';

describe('PageHeader', () => {
it('shallow renders with the date picker', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import { shallowWithIntl } from '@kbn/test/jest';
import { withResponsiveWrapper } from '../responsive_wrapper';
import { withResponsiveWrapper } from './responsive_wrapper';

interface Prop {
isResponsive: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { shallowWithIntl } from '@kbn/test/jest';
import React from 'react';
import { LocationLink } from '../location_link';
import { LocationLink } from './location_link';

describe('LocationLink component', () => {
it('renders the location when present', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import { shallowWithIntl } from '@kbn/test/jest';
import { MonitorPageLink } from '../monitor_page_link';
import { MonitorPageLink } from './monitor_page_link';

describe('MonitorPageLink component', () => {
it('renders the link properly', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import { render, fireEvent, screen } from '@testing-library/react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { MonitorTags } from '../monitor_tags';
import * as hooks from '../../../hooks/use_url_params';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { MonitorTags } from './monitor_tags';
import * as hooks from '../../hooks/use_url_params';
import { renderWithRouter, shallowWithRouter } from '../../lib';

describe('MonitorTags component', () => {
const summaryPing = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { letBrowserHandleEvent } from '../index';
import { letBrowserHandleEvent } from './index';

describe('letBrowserHandleEvent', () => {
const event = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import React from 'react';
import { shallow, mount } from 'enzyme';
import { EuiLink, EuiButton } from '@elastic/eui';

import '../../../../lib/__mocks__/ut_router_history.mock';
import '../../../lib/__mocks__/ut_router_history.mock';

import { ReactRouterEuiLink, ReactRouterEuiButton } from '../link_for_eui';
import { mockHistory } from '../../../../lib/__mocks__/ut_router_history.mock';
import { ReactRouterEuiLink, ReactRouterEuiButton } from './link_for_eui';
import { mockHistory } from '../../../lib/__mocks__/ut_router_history.mock';

describe('EUI & React Router Component Helpers', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
*/

import React from 'react';
import { UptimeDatePicker } from '../uptime_date_picker';
import { UptimeDatePicker } from './uptime_date_picker';
import {
renderWithRouter,
shallowWithRouter,
MountWithReduxProvider,
mountWithRouterRedux,
} from '../../../lib';
import { UptimeStartupPluginsContextProvider } from '../../../contexts';
import { startPlugins } from '../../../lib/__mocks__/uptime_plugin_start_mock';
import { ClientPluginsStart } from '../../../apps/plugin';
} from '../../lib';
import { UptimeStartupPluginsContextProvider } from '../../contexts';
import { startPlugins } from '../../lib/__mocks__/uptime_plugin_start_mock';
import { ClientPluginsStart } from '../../apps/plugin';
import { createMemoryHistory } from 'history';

describe('UptimeDatePicker component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import { shallowWithIntl } from '@kbn/test/jest';
import { ConfirmJobDeletion } from '../confirm_delete';
import { ConfirmJobDeletion } from './confirm_delete';

describe('ML Confirm Job Delete', () => {
it('shallow renders without errors', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest';
import { ShowLicenseInfo } from '../license_info';
import { ShowLicenseInfo } from './license_info';
import * as redux from 'react-redux';

describe('ShowLicenseInfo', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import React from 'react';
import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest';
import { MLFlyoutView } from '../ml_flyout';
import { UptimeSettingsContext } from '../../../../contexts';
import { CLIENT_DEFAULTS } from '../../../../../common/constants';
import { MLFlyoutView } from './ml_flyout';
import { UptimeSettingsContext } from '../../../contexts';
import { CLIENT_DEFAULTS } from '../../../../common/constants';
import * as redux from 'react-redux';

describe('ML Flyout component', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/

import React from 'react';
import { MLIntegrationComponent } from '../ml_integeration';
import { renderWithRouter, shallowWithRouter } from '../../../../lib';
import { MLIntegrationComponent } from './ml_integeration';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import * as redux from 'react-redux';
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';
import { coreMock } from 'src/core/public/mocks';

const core = coreMock.createStart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import React from 'react';
import { coreMock } from 'src/core/public/mocks';
import { renderWithRouter, shallowWithRouter } from '../../../../lib';
import { MLJobLink } from '../ml_job_link';
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { MLJobLink } from './ml_job_link';
import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';

const core = coreMock.createStart();
describe('ML JobLink', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import React from 'react';
import { coreMock } from 'src/core/public/mocks';
import { ManageMLJobComponent } from '../manage_ml_job';
import { ManageMLJobComponent } from './manage_ml_job';
import * as redux from 'react-redux';
import { renderWithRouter, shallowWithRouter } from '../../../../lib';
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
import { renderWithRouter, shallowWithRouter } from '../../../lib';
import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public';

const core = coreMock.createStart();
describe('Manage ML Job', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import React from 'react';
import DateMath from '@elastic/datemath';
import { MonitorCharts } from '../monitor_charts';
import { shallowWithRouter } from '../../../lib';
import { MonitorCharts } from './monitor_charts';
import { shallowWithRouter } from '../../lib';

describe('MonitorCharts component', () => {
let dateMathSpy: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import React from 'react';
import { shallowWithIntl, renderWithIntl } from '@kbn/test/jest';
import { PingTimestamp } from '../ping_timestamp';
import { mockReduxHooks } from '../../../../../lib/helper/test_helpers';
import { Ping } from '../../../../../../common/runtime_types/ping';
import { EuiThemeProvider } from '../../../../../../../observability/public';
import { PingTimestamp } from './ping_timestamp';
import { mockReduxHooks } from '../../../../lib/helper/test_helpers';
import { Ping } from '../../../../../common/runtime_types/ping';
import { EuiThemeProvider } from '../../../../../../observability/public';

mockReduxHooks();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { shallowWithIntl } from '@kbn/test/jest';
import React from 'react';
import { DocLinkForBody } from '../doc_link_body';
import { DocLinkForBody } from './doc_link_body';

describe('PingListExpandedRow', () => {
it('renders expected elements for valid props', () => {
Expand Down
Loading