Skip to content

Commit

Permalink
fixed typechecks
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Dec 4, 2020
1 parent eb1e611 commit c8e249e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 23 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,11 @@ import React from 'react';
import { shallow } from 'enzyme';
import { EntityIndexExpression } from './expressions/entity_index_expression';
import { BoundaryIndexExpression } from './expressions/boundary_index_expression';
import { ApplicationStart, DocLinksStart, HttpSetup, ToastsStart } from 'kibana/public';
import {
ActionTypeRegistryContract,
AlertTypeRegistryContract,
IErrorObject,
} from '../../../../../triggers_actions_ui/public';
import { IErrorObject } from '../../../../../triggers_actions_ui/public';
import { IIndexPattern } from '../../../../../../../src/plugins/data/common';
import { dataPluginMock } from 'src/plugins/data/public/mocks';

const alertsContext = {
http: (null as unknown) as HttpSetup,
alertTypeRegistry: (null as unknown) as AlertTypeRegistryContract,
actionTypeRegistry: (null as unknown) as ActionTypeRegistryContract,
toastNotifications: (null as unknown) as ToastsStart,
docLinks: (null as unknown) as DocLinksStart,
capabilities: (null as unknown) as ApplicationStart['capabilities'],
};
const dataStartMock = dataPluginMock.createStartContract();

const alertParams = {
index: '',
Expand All @@ -42,14 +31,14 @@ test('should render EntityIndexExpression', async () => {
<EntityIndexExpression
dateField={'testDateField'}
geoField={'testGeoField'}
alertsContext={alertsContext}
errors={{} as IErrorObject}
setAlertParamsDate={() => {}}
setAlertParamsGeoField={() => {}}
setAlertProperty={() => {}}
setIndexPattern={() => {}}
indexPattern={('' as unknown) as IIndexPattern}
isInvalid={false}
data={dataStartMock}
/>
);

Expand All @@ -61,14 +50,14 @@ test('should render EntityIndexExpression w/ invalid flag if invalid', async ()
<EntityIndexExpression
dateField={'testDateField'}
geoField={'testGeoField'}
alertsContext={alertsContext}
errors={{} as IErrorObject}
setAlertParamsDate={() => {}}
setAlertParamsGeoField={() => {}}
setAlertProperty={() => {}}
setIndexPattern={() => {}}
indexPattern={('' as unknown) as IIndexPattern}
isInvalid={true}
data={dataStartMock}
/>
);

Expand All @@ -79,13 +68,13 @@ test('should render BoundaryIndexExpression', async () => {
const component = shallow(
<BoundaryIndexExpression
alertParams={alertParams}
alertsContext={alertsContext}
errors={{} as IErrorObject}
boundaryIndexPattern={('' as unknown) as IIndexPattern}
setBoundaryIndexPattern={() => {}}
setBoundaryGeoField={() => {}}
setBoundaryNameField={() => {}}
boundaryNameField={'testNameField'}
data={dataStartMock}
/>
);

Expand Down

0 comments on commit c8e249e

Please sign in to comment.