From 5a0b94077ec55ebce2fe8118326615d0ce7b4917 Mon Sep 17 00:00:00 2001 From: Yaliang <49084640+ylwu-amzn@users.noreply.github.com> Date: Wed, 29 Apr 2020 20:13:43 -0700 Subject: [PATCH] add chart and ad result css file; fix some ut (#64) --- public/app.scss | 2 ++ .../__tests__/AggregationSelector.test.tsx | 2 +- .../CustomAggregation/__tests__/CustomAggregation.test.tsx | 2 +- public/redux/reducers/__tests__/ad.test.ts | 5 ++++- public/redux/reducers/__tests__/anomalyResults.test.ts | 1 + public/utils/utils.ts | 1 - 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/app.scss b/public/app.scss index 8c0b500d..a580c547 100644 --- a/public/app.scss +++ b/public/app.scss @@ -17,3 +17,5 @@ @import 'pages/createDetector/index.scss'; @import 'pages/Dashboard/index.scss'; @import 'pages/DetectorConfig/index.scss'; +@import 'pages/AnomalyCharts/index.scss'; +@import 'pages/DetectorResults/index.scss'; diff --git a/public/pages/EditFeatures/components/AggregationSelector/__tests__/AggregationSelector.test.tsx b/public/pages/EditFeatures/components/AggregationSelector/__tests__/AggregationSelector.test.tsx index 4731cda1..bee4c3b1 100644 --- a/public/pages/EditFeatures/components/AggregationSelector/__tests__/AggregationSelector.test.tsx +++ b/public/pages/EditFeatures/components/AggregationSelector/__tests__/AggregationSelector.test.tsx @@ -23,7 +23,7 @@ import { mockedStore, } from '../../../../../redux/utils/testUtils'; import { FeaturesFormikValues } from '../../../containers/utils/formikToFeatures'; -import { INITIAL_VALUES } from '../../../containers/utils/constants'; +import { INITIAL_VALUES } from '../../../utils/constants'; const renderAggregationSelector = (initialValue: FeaturesFormikValues) => ({ ...render( diff --git a/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx b/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx index 4206ee9a..7148d68e 100644 --- a/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx +++ b/public/pages/EditFeatures/components/CustomAggregation/__tests__/CustomAggregation.test.tsx @@ -20,7 +20,7 @@ import { Provider } from 'react-redux'; import { mockedStore } from '../../../../../redux/utils/testUtils'; import { Formik } from 'formik'; import { FeaturesFormikValues } from '../../../../EditFeatures/containers/utils/formikToFeatures'; -import { INITIAL_VALUES } from '../../../../EditFeatures/containers/utils/constants'; +import { INITIAL_VALUES } from '../../../../EditFeatures/utils/constants'; const renderWithFormik = (initialValue: FeaturesFormikValues) => ({ ...render( diff --git a/public/redux/reducers/__tests__/ad.test.ts b/public/redux/reducers/__tests__/ad.test.ts index 9d1a1e08..d577db69 100644 --- a/public/redux/reducers/__tests__/ad.test.ts +++ b/public/redux/reducers/__tests__/ad.test.ts @@ -11,6 +11,7 @@ import reducer, { updateDetector, } from '../ad'; import { getRandomDetector } from './utils'; +import { get } from 'lodash'; describe('detector reducer actions', () => { let store: MockStore; @@ -197,13 +198,15 @@ describe('detector reducer actions', () => { requesting: true, }); expect(actions[1].type).toBe('ad/UPDATE_DETECTOR_SUCCESS'); - expect(reducer(initialDetectorsState, actions[1])).toEqual({ + const result = reducer(initialDetectorsState, actions[1]); + expect(result).toEqual({ ...initialDetectorsState, requesting: false, detectors: { [detectorId]: { ...randomDetector, id: detectorId, + lastUpdateTime: get(result, `detectors.${detectorId}.lastUpdateTime`) }, }, }); diff --git a/public/redux/reducers/__tests__/anomalyResults.test.ts b/public/redux/reducers/__tests__/anomalyResults.test.ts index 0cff3c14..af14bbeb 100644 --- a/public/redux/reducers/__tests__/anomalyResults.test.ts +++ b/public/redux/reducers/__tests__/anomalyResults.test.ts @@ -44,6 +44,7 @@ describe('elasticsearch reducer actions', () => { requesting: false, total: response.totalAnomalies, anomalies: response.results, + "featureData": undefined, }); expect(httpMockedClient.get).toHaveBeenCalledWith( `..${AD_NODE_API.DETECTOR}/${tempDetectorId}/results`, diff --git a/public/utils/utils.ts b/public/utils/utils.ts index a2256657..286f25b5 100644 --- a/public/utils/utils.ts +++ b/public/utils/utils.ts @@ -22,7 +22,6 @@ import { ALERTING_PLUGIN_NAME, NAME_REGEX } from './constants'; import { MAX_FEATURE_NAME_SIZE } from './constants'; export const validateName = (featureName: string): string | undefined => { - debugger; if (isEmpty(featureName)) { return 'Required'; }