chore(NA): move apm plugin tests out of __tests__ folder (#87601)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tiago Costa 2021-01-07 18:26:16 +00:00 committed by GitHub
parent 0ac6e6223e
commit d6816384a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 94 additions and 94 deletions

View file

@ -6,11 +6,11 @@
import { mount } from 'enzyme';
import React from 'react';
import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../../../context/url_params_context/mock_url_params_context_provider';
import { mockMoment, toJson } from '../../../../../utils/testHelpers';
import { ErrorGroupList } from '../index';
import props from './props.json';
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { MockUrlParamsContextProvider } from '../../../../context/url_params_context/mock_url_params_context_provider';
import { mockMoment, toJson } from '../../../../utils/testHelpers';
import { ErrorGroupList } from './index';
import props from './__fixtures__/props.json';
import { MemoryRouter } from 'react-router-dom';
jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => {

View file

@ -5,9 +5,9 @@
*/
import React from 'react';
import { createMemoryHistory } from 'history';
import * as fetcherHook from '../../../../../../hooks/use_fetcher';
import { SelectableUrlList } from '../SelectableUrlList';
import { render } from '../../../utils/test_helper';
import * as fetcherHook from '../../../../../hooks/use_fetcher';
import { SelectableUrlList } from './SelectableUrlList';
import { render } from '../../utils/test_helper';
describe('SelectableUrlList', () => {
it('it uses search term value from url', () => {

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { formatToSec } from '../KeyUXMetrics';
import { formatToSec } from './KeyUXMetrics';
describe('FormatToSec', () => {
test('it returns the expected value', () => {

View file

@ -5,8 +5,8 @@
*/
import React from 'react';
import { render } from '@testing-library/react';
import * as fetcherHook from '../../../../../hooks/use_fetcher';
import { KeyUXMetrics } from '../KeyUXMetrics';
import * as fetcherHook from '../../../../hooks/use_fetcher';
import { KeyUXMetrics } from './KeyUXMetrics';
describe('KeyUXMetrics', () => {
it('renders metrics with correct formats', () => {

View file

@ -7,9 +7,9 @@
import { render } from 'enzyme';
import React from 'react';
import { EmbeddedMap } from '../EmbeddedMap';
import { KibanaContextProvider } from '../../../../../../../../../src/plugins/kibana_react/public';
import { embeddablePluginMock } from '../../../../../../../../../src/plugins/embeddable/public/mocks';
import { EmbeddedMap } from './EmbeddedMap';
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
import { embeddablePluginMock } from '../../../../../../../../src/plugins/embeddable/public/mocks';
describe('Embedded Map', () => {
test('it renders', () => {

View file

@ -7,7 +7,7 @@
import { render, shallow } from 'enzyme';
import React from 'react';
import { MapToolTip } from '../MapToolTip';
import { MapToolTip } from './MapToolTip';
describe('Map Tooltip', () => {
test('it shallow renders', () => {

View file

@ -6,7 +6,7 @@
import { renderHook } from '@testing-library/react-hooks';
import { mockLayerList } from './__mocks__/regions_layer.mock';
import { useLayerList } from '../useLayerList';
import { useLayerList } from './useLayerList';
describe('useLayerList', () => {
test('it returns the region layer', () => {

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getFormattedBuckets } from '../index';
import { getFormattedBuckets } from './index';
describe('Distribution', () => {
it('getFormattedBuckets', () => {

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Transaction } from '../../../../../../../../typings/es_schemas/ui/transaction';
import { getAgentMarks } from '../get_agent_marks';
import { Transaction } from '../../../../../../../typings/es_schemas/ui/transaction';
import { getAgentMarks } from './get_agent_marks';
describe('getAgentMarks', () => {
it('should sort the marks by time', () => {

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { IWaterfallError } from '../../Waterfall/waterfall_helpers/waterfall_helpers';
import { getErrorMarks } from '../get_error_marks';
import { IWaterfallError } from '../Waterfall/waterfall_helpers/waterfall_helpers';
import { getErrorMarks } from './get_error_marks';
describe('getErrorMarks', () => {
describe('returns empty array', () => {

View file

@ -21,7 +21,7 @@ import {
import { FETCH_STATUS } from '../../../hooks/use_fetcher';
import * as useLocalUIFilters from '../../../hooks/useLocalUIFilters';
import * as useDynamicIndexPatternHooks from '../../../hooks/use_dynamic_index_pattern';
import { SessionStorageMock } from '../../../services/__test__/SessionStorageMock';
import { SessionStorageMock } from '../../../services/__mocks__/SessionStorageMock';
import { MockUrlParamsContextProvider } from '../../../context/url_params_context/mock_url_params_context_provider';
import * as hook from './use_anomaly_detection_jobs_fetcher';

View file

@ -6,7 +6,7 @@
import { shallow } from 'enzyme';
import React from 'react';
import { ImpactBar } from '..';
import { ImpactBar } from '.';
describe('ImpactBar component', () => {
it('should render with default values', () => {

View file

@ -5,9 +5,9 @@
*/
import React from 'react';
import { KeyValueTable } from '..';
import { KeyValueTable } from '.';
import { render } from '@testing-library/react';
import { renderWithTheme } from '../../../../utils/testHelpers';
import { renderWithTheme } from '../../../utils/testHelpers';
function getKeys(output: ReturnType<typeof render>) {
const keys = output.getAllByTestId('dot-key');

View file

@ -6,8 +6,8 @@
import { shallow, ShallowWrapper } from 'enzyme';
import React from 'react';
import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverErrorLink } from '../DiscoverErrorLink';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverErrorLink } from './DiscoverErrorLink';
describe('DiscoverErrorLink without kuery', () => {
let wrapper: ShallowWrapper;

View file

@ -6,8 +6,8 @@
import { shallow, ShallowWrapper } from 'enzyme';
import React from 'react';
import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverErrorLink } from '../DiscoverErrorLink';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { DiscoverErrorLink } from './DiscoverErrorLink';
describe('DiscoverErrorLink without kuery', () => {
let wrapper: ShallowWrapper;

View file

@ -6,13 +6,13 @@
import { Location } from 'history';
import React from 'react';
import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import { Span } from '../../../../../../typings/es_schemas/ui/span';
import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import { getRenderedHref } from '../../../../../utils/testHelpers';
import { DiscoverErrorLink } from '../DiscoverErrorLink';
import { DiscoverSpanLink } from '../DiscoverSpanLink';
import { DiscoverTransactionLink } from '../DiscoverTransactionLink';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { Span } from '../../../../../typings/es_schemas/ui/span';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { getRenderedHref } from '../../../../utils/testHelpers';
import { DiscoverErrorLink } from './DiscoverErrorLink';
import { DiscoverSpanLink } from './DiscoverSpanLink';
import { DiscoverTransactionLink } from './DiscoverTransactionLink';
describe('DiscoverLinks', () => {
it('produces the correct URL for a transaction', async () => {

View file

@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
// @ts-expect-error
import configureStore from '../../../../../store/config/configureStore';
import { getDiscoverQuery } from '../DiscoverTransactionLink';
import { getDiscoverQuery } from './DiscoverTransactionLink';
function getMockTransaction() {
return {

View file

@ -6,12 +6,12 @@
import { shallow } from 'enzyme';
import React from 'react';
import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import {
DiscoverTransactionLink,
getDiscoverQuery,
} from '../DiscoverTransactionLink';
import mockTransaction from './mock_transaction.json';
} from './DiscoverTransactionLink';
import mockTransaction from './__fixtures__/mock_transaction.json';
describe('DiscoverTransactionLink component', () => {
it('should render with data', () => {

View file

@ -6,7 +6,7 @@
import { shallow } from 'enzyme';
import React from 'react';
import { UnoptimizedManagedTable } from '..';
import { UnoptimizedManagedTable } from '.';
describe('ManagedTable component', () => {
let people;

View file

@ -7,13 +7,13 @@
import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { ErrorMetadata } from '..';
import { APMError } from '../../../../../../typings/es_schemas/ui/apm_error';
import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import { ErrorMetadata } from '.';
import { APMError } from '../../../../../typings/es_schemas/ui/apm_error';
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
} from '../../../../../utils/testHelpers';
} from '../../../../utils/testHelpers';
function Wrapper({ children }: { children?: ReactNode }) {
return (

View file

@ -7,10 +7,10 @@
import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { MetadataTable } from '..';
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { expectTextsInDocument } from '../../../../utils/testHelpers';
import { SectionsWithRows } from '../helper';
import { MetadataTable } from '.';
import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { expectTextsInDocument } from '../../../utils/testHelpers';
import { SectionsWithRows } from './helper';
function Wrapper({ children }: { children?: ReactNode }) {
return (

View file

@ -5,8 +5,8 @@
*/
import React from 'react';
import { render } from '@testing-library/react';
import { Section } from '../Section';
import { expectTextsInDocument } from '../../../../utils/testHelpers';
import { Section } from './Section';
import { expectTextsInDocument } from '../../../utils/testHelpers';
describe('Section', () => {
it('shows "empty state message" if no data is available', () => {

View file

@ -7,13 +7,13 @@
import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { SpanMetadata } from '..';
import { Span } from '../../../../../../typings/es_schemas/ui/span';
import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import { SpanMetadata } from '.';
import { Span } from '../../../../../typings/es_schemas/ui/span';
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
} from '../../../../../utils/testHelpers';
} from '../../../../utils/testHelpers';
function Wrapper({ children }: { children?: ReactNode }) {
return (

View file

@ -7,13 +7,13 @@
import { render } from '@testing-library/react';
import React, { ReactNode } from 'react';
import { MemoryRouter } from 'react-router-dom';
import { TransactionMetadata } from '..';
import { Transaction } from '../../../../../../typings/es_schemas/ui/transaction';
import { MockApmPluginContextWrapper } from '../../../../../context/apm_plugin/mock_apm_plugin_context';
import { TransactionMetadata } from '.';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import {
expectTextsInDocument,
expectTextsNotInDocument,
} from '../../../../../utils/testHelpers';
} from '../../../../utils/testHelpers';
function Wrapper({ children }: { children?: ReactNode }) {
return (

View file

@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getSectionsWithRows, filterSectionsByTerm } from '../helper';
import { LABELS, HTTP, SERVICE } from '../sections';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { getSectionsWithRows, filterSectionsByTerm } from './helper';
import { LABELS, HTTP, SERVICE } from './sections';
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
describe('MetadataTable Helper', () => {
const sections = [

View file

@ -5,11 +5,11 @@
*/
import React from 'react';
import { ErrorCountSummaryItemBadge } from '../ErrorCountSummaryItemBadge';
import { ErrorCountSummaryItemBadge } from './ErrorCountSummaryItemBadge';
import {
expectTextsInDocument,
renderWithTheme,
} from '../../../../utils/testHelpers';
} from '../../../utils/testHelpers';
describe('ErrorCountSummaryItemBadge', () => {
it('shows singular error message', () => {

View file

@ -6,8 +6,8 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import { HttpInfoSummaryItem } from '../';
import * as exampleTransactions from '../../__fixtures__/transactions';
import { HttpInfoSummaryItem } from '.';
import * as exampleTransactions from '../__fixtures__/transactions';
describe('HttpInfoSummaryItem', () => {
describe('render', () => {

View file

@ -6,13 +6,13 @@
import React from 'react';
import { mount } from 'enzyme';
import { HttpStatusBadge } from '../index';
import { HttpStatusBadge } from './index';
import {
successColor,
neutralColor,
warningColor,
errorColor,
} from '../../../../../utils/httpStatusCodeToColor';
} from '../../../../utils/httpStatusCodeToColor';
describe('HttpStatusBadge', () => {
describe('render', () => {

View file

@ -7,8 +7,8 @@
import { shallow } from 'enzyme';
import React from 'react';
import moment from 'moment-timezone';
import { TimestampTooltip } from '../index';
import { mockNow } from '../../../../utils/testHelpers';
import { TimestampTooltip } from './index';
import { mockNow } from '../../../utils/testHelpers';
describe('TimestampTooltip', () => {
const timestamp = 1570720000123; // Oct 10, 2019, 08:06:40.123 (UTC-7)

View file

@ -7,18 +7,18 @@
import { act, fireEvent, render } from '@testing-library/react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { License } from '../../../../../../licensing/common/license';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { MockApmPluginContextWrapper } from '../../../../context/apm_plugin/mock_apm_plugin_context';
import { LicenseContext } from '../../../../context/license/license_context';
import * as hooks from '../../../../hooks/use_fetcher';
import * as apmApi from '../../../../services/rest/createCallApmApi';
import { License } from '../../../../../licensing/common/license';
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
import { LicenseContext } from '../../../context/license/license_context';
import * as hooks from '../../../hooks/use_fetcher';
import * as apmApi from '../../../services/rest/createCallApmApi';
import {
expectTextsInDocument,
expectTextsNotInDocument,
} from '../../../../utils/testHelpers';
import { TransactionActionMenu } from '../TransactionActionMenu';
import * as Transactions from './mockData';
} from '../../../utils/testHelpers';
import { TransactionActionMenu } from './TransactionActionMenu';
import * as Transactions from './__fixtures__/mockData';
function Wrapper({ children }: { children?: React.ReactNode }) {
return (

View file

@ -5,8 +5,8 @@
*/
import { Location } from 'history';
import { IBasePath } from 'kibana/public';
import { Transaction } from '../../../../../typings/es_schemas/ui/transaction';
import { getSections } from '../sections';
import { Transaction } from '../../../../typings/es_schemas/ui/transaction';
import { getSections } from './sections';
describe('Transaction action menu', () => {
const basePath = ({

View file

@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { mockNow } from '../../utils/testHelpers';
import { clearCache, callApi } from '../rest/callApi';
import { SessionStorageMock } from './SessionStorageMock';
import { mockNow } from '../utils/testHelpers';
import { clearCache, callApi } from './rest/callApi';
import { SessionStorageMock } from './__mocks__/SessionStorageMock';
import { HttpSetup } from 'kibana/public';
type HttpMock = HttpSetup & {

View file

@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import * as callApiExports from '../rest/callApi';
import { createCallApmApi, callApmApi } from '../rest/createCallApmApi';
import * as callApiExports from './rest/callApi';
import { createCallApmApi, callApmApi } from './rest/createCallApmApi';
import { HttpSetup } from 'kibana/public';
const callApi = jest

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { flattenObject } from '../flattenObject';
import { flattenObject } from './flattenObject';
describe('FlattenObject', () => {
it('flattens multi level item', () => {

View file

@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getBuckets } from '../get_buckets';
import { APMConfig } from '../../../..';
import { ProcessorEvent } from '../../../../../common/processor_event';
import { getBuckets } from './get_buckets';
import { APMConfig } from '../../..';
import { ProcessorEvent } from '../../../../common/processor_event';
describe('get buckets', () => {
let clientSpy: jest.Mock;

View file

@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { getEnvironmentUiFilterES } from '../get_environment_ui_filter_es';
import { ENVIRONMENT_NOT_DEFINED } from '../../../../../common/environment_filter_values';
import { SERVICE_ENVIRONMENT } from '../../../../../common/elasticsearch_fieldnames';
import { getEnvironmentUiFilterES } from './get_environment_ui_filter_es';
import { ENVIRONMENT_NOT_DEFINED } from '../../../../common/environment_filter_values';
import { SERVICE_ENVIRONMENT } from '../../../../common/elasticsearch_fieldnames';
describe('getEnvironmentUiFilterES', () => {
it('should return empty array, when environment is undefined', () => {