diff --git a/public/pages/AnomalyCharts/components/AlertsButton/__tests__/AlertsButton.test.tsx b/public/pages/AnomalyCharts/components/AlertsButton/__tests__/AlertsButton.test.tsx index a52a73a7..7764d24d 100644 --- a/public/pages/AnomalyCharts/components/AlertsButton/__tests__/AlertsButton.test.tsx +++ b/public/pages/AnomalyCharts/components/AlertsButton/__tests__/AlertsButton.test.tsx @@ -19,8 +19,12 @@ import { AlertsButton } from '../AlertsButton'; import { getRandomMonitor } from '../../../../../redux/reducers/__tests__/utils'; describe(' spec', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); describe('Alerts Button', () => { test('renders component without monitor', () => { + console.error = jest.fn(); const { container } = render( spec', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); const detectorId = "GILVg3EBhaIh92zvX8uE"; describe('Alerts Flyout', () => { test('renders component with monitor', () => { + console.error = jest.fn(); const { container } = render( spec', () => { }); test('renders component with undefined monitor', () => { + console.error = jest.fn(); const { container } = render( spec', () => { }); describe(' spec', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); describe('Alert Stat', () => { test('renders component with undefined monitor and loading', () => { + console.error = jest.fn(); const { container } = render( spec', () => { }); test('renders component with undefined monitor and not loading', () => { + console.error = jest.fn(); const { container } = render( ({ anomalySummary={undefined} dateRange={dateRange} isLoading={false} - anomalyGradeSeriesName="anoaly grade" + anomalyGradeSeriesName="anomaly grade" confidenceSeriesName="confidence" detectorId="testDetectorId" detectorName="testDetectorName" @@ -72,7 +72,8 @@ const renderDataFilter = () => ({ describe(' spec', () => { test('renders the component', () => { + console.error = jest.fn(); const { getByText } = renderDataFilter(); - expect(getByText('anoaly grade')).not.toBeNull(); + expect(getByText('anomaly grade')).not.toBeNull(); }); }); diff --git a/public/pages/AnomalyCharts/containers/__tests__/FeatureBreakDown.test.tsx b/public/pages/AnomalyCharts/containers/__tests__/FeatureBreakDown.test.tsx index 5423694f..223973e4 100644 --- a/public/pages/AnomalyCharts/containers/__tests__/FeatureBreakDown.test.tsx +++ b/public/pages/AnomalyCharts/containers/__tests__/FeatureBreakDown.test.tsx @@ -52,6 +52,7 @@ describe(' spec', () => { featureData: featureData, }; test('renders the component', () => { + console.error = jest.fn(); const { container } = render( spec', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); describe('Monitor callout', () => { + console.error = jest.fn(); test('renders component', () => { const { container } = render( spec', () => { await wait(); getByText('04/15/2020 7:30 AM'); expect(queryByText('04/15/2020 7:00 AM')).toBeNull(); - }); + }, 20000); test('should be able to search', async () => { const randomDetectors = new Array(40).fill(null).map((_, index) => { const hasAnomaly = Math.random() > 0.5; diff --git a/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx b/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx index 7148d68e..7ce7109c 100644 --- a/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx +++ b/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx @@ -37,6 +37,9 @@ const renderWithFormik = (initialValue: FeaturesFormikValues) => ({ }); describe(' spec', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); test('renders the component', () => { const { container } = renderWithFormik(INITIAL_VALUES); expect(container.firstChild).toMatchSnapshot(); @@ -47,6 +50,7 @@ describe(' spec', () => { expect(validateQuery('{"a":{"b":{}}}')).toBeUndefined(); }); test('should return error message if invalid query', () => { + console.log = jest.fn(); expect(validateQuery('hello')).toEqual('Invalid JSON'); expect(validateQuery('{a : b: {}')).toEqual('Invalid JSON'); }); diff --git a/public/pages/EditFeatures/containers/SampleAnomalies.tsx b/public/pages/EditFeatures/containers/SampleAnomalies.tsx index 86d5767e..9e1b15fd 100644 --- a/public/pages/EditFeatures/containers/SampleAnomalies.tsx +++ b/public/pages/EditFeatures/containers/SampleAnomalies.tsx @@ -125,7 +125,7 @@ export function SampleAnomalies(props: SampleAnomaliesProps) { setPreviewDone(true); setFirstPreview(false); } catch (err) { - console.error(`Fail to preivew detector ${detector.id}`, err); + console.error(`Fail to preview detector ${detector.id}`, err); setIsLoading(false); toastNotifications.addDanger( getPreviewErrorMessage(err, 'There was a problem previewing detector') diff --git a/public/pages/createDetector/components/DataFilters/SimpleFilter.tsx b/public/pages/createDetector/components/DataFilters/SimpleFilter.tsx index 3e2dfe78..301c9e24 100644 --- a/public/pages/createDetector/components/DataFilters/SimpleFilter.tsx +++ b/public/pages/createDetector/components/DataFilters/SimpleFilter.tsx @@ -98,9 +98,8 @@ export const SimpleFilter = (props: DataFilterProps) => { {values.filters.map((filter: UIFilter, index: number) => { return ( - + spec renders the component 1`] = `
diff --git a/public/pages/createDetector/components/FormattedFormRow/FormattedFormRow.tsx b/public/pages/createDetector/components/FormattedFormRow/FormattedFormRow.tsx index fa7f68cd..8e1b35c5 100644 --- a/public/pages/createDetector/components/FormattedFormRow/FormattedFormRow.tsx +++ b/public/pages/createDetector/components/FormattedFormRow/FormattedFormRow.tsx @@ -32,20 +32,21 @@ export const FormattedFormRow = (props: FormattedFormRowProps) => { if (props.hint) { const hintTexts = Array.isArray(props.hint) ? props.hint : [props.hint]; hints = hintTexts.map((hint, i) => { - return

{hint}

; + return

{hint}

; }); } + const {formattedTitle, ...euiFormRowProps} = props; return ( - {props.formattedTitle ? props.formattedTitle :

{props.title}

} + {formattedTitle ? formattedTitle :

{props.title}

}
{hints}
} - {...props} + {...euiFormRowProps} > {props.children} diff --git a/public/pages/createDetector/containers/__tests__/CreateDetector.test.tsx b/public/pages/createDetector/containers/__tests__/CreateDetector.test.tsx index f6c413f7..d908ca17 100644 --- a/public/pages/createDetector/containers/__tests__/CreateDetector.test.tsx +++ b/public/pages/createDetector/containers/__tests__/CreateDetector.test.tsx @@ -29,7 +29,6 @@ import { getRandomDetector } from '../../../../redux/reducers/__tests__/utils'; import configureStore from '../../../../redux/configureStore'; import { httpClientMock } from '../../../../../test/mocks'; import userEvent from '@testing-library/user-event'; -import { UNITS } from '../../../../models/interfaces'; const renderWithRouter = (isEdit: boolean = false) => ({ ...render( diff --git a/public/pages/createDetector/containers/__tests__/__snapshots__/CreateDetector.test.tsx.snap b/public/pages/createDetector/containers/__tests__/__snapshots__/CreateDetector.test.tsx.snap index 3fb54894..59c009a8 100644 --- a/public/pages/createDetector/containers/__tests__/__snapshots__/CreateDetector.test.tsx.snap +++ b/public/pages/createDetector/containers/__tests__/__snapshots__/CreateDetector.test.tsx.snap @@ -115,7 +115,6 @@ exports[` spec create detector renders the component 1`] = `
@@ -381,7 +380,6 @@ exports[` spec create detector renders the component 1`] = `
diff --git a/public/pages/createDetector/containers/utils/__tests__/formikToDetector.test.ts b/public/pages/createDetector/containers/utils/__tests__/formikToDetector.test.ts index ba65c568..4a912c54 100644 --- a/public/pages/createDetector/containers/utils/__tests__/formikToDetector.test.ts +++ b/public/pages/createDetector/containers/utils/__tests__/formikToDetector.test.ts @@ -41,8 +41,6 @@ describe('formikToAd', () => { }, {} as Detector ); - console.log(ad); - console.log(randomDetector); expect(ad).toEqual({ name: randomDetector.name, description: randomDetector.description,