Skip to content

Commit

Permalink
chore(NA): move apm plugin tests out of __tests__ folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Jan 6, 2021
1 parent a95fdbd commit f5288d4
Show file tree
Hide file tree
Showing 52 changed files with 94 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
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 { formatToSec } from '../KeyUXMetrics';
import { formatToSec } from './KeyUXMetrics';

describe('FormatToSec', () => {
test('it returns the expected value', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
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 { getFormattedBuckets } from '../index';
import { getFormattedBuckets } from './index';

describe('Distribution', () => {
it('getFormattedBuckets', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { shallow } from 'enzyme';
import React from 'react';
import { UnoptimizedManagedTable } from '..';
import { UnoptimizedManagedTable } from '.';

describe('ManagedTable component', () => {
let people;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Loading

0 comments on commit f5288d4

Please sign in to comment.