Skip to content

Commit

Permalink
tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Sep 13, 2021
1 parent 85af771 commit 2344db3
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 284 deletions.
6 changes: 6 additions & 0 deletions src/plugins/data/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { searchServiceMock } from './search/mocks';
import { queryServiceMock } from './query/mocks';
import { AutocompleteStart, AutocompleteSetup } from './autocomplete';
import { createNowProviderMock } from './now_provider/mocks';
import { FilterEditorSetup } from './ui/filter_bar/filter_editor/filter_editor_service';

export type Setup = jest.Mocked<ReturnType<DataPlugin['setup']>>;
export type Start = jest.Mocked<ReturnType<DataPlugin['start']>>;
Expand All @@ -27,12 +28,17 @@ const autocompleteStartMock: jest.Mocked<AutocompleteStart> = {
hasQuerySuggestions: jest.fn(),
};

const filterEditorSetupMock: jest.Mocked<FilterEditorSetup> = {
registerFilterOperator: jest.fn(),
};

const createSetupContract = (): Setup => {
const querySetupMock = queryServiceMock.createSetupContract();
return {
autocomplete: autocompleteSetupMock,
search: searchServiceMock.createSetupContract(),
query: querySetupMock,
filterEditor: filterEditorSetupMock,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,15 @@ import { Filter, FILTERS } from '@kbn/es-query';

// Use mapSpatialFilter mapper to avoid bloated meta with value and params for spatial filters.
export const mapSpatialFilter = (filter: Filter) => {
if (
filter.meta &&
filter.meta.key &&
filter.meta.type === FILTERS.SPATIAL_FILTER
) {
if (filter.meta && filter.meta.key && filter.meta.type === FILTERS.SPATIAL_FILTER) {
return {
key: filter.meta.key,
type: filter.meta.type,
value: '',
};
}

if (
filter.meta &&
filter.meta.type === FILTERS.SPATIAL_FILTER &&
filter.meta.isMultiIndex
) {
if (filter.meta && filter.meta.type === FILTERS.SPATIAL_FILTER && filter.meta.isMultiIndex) {
return {
key: 'query',
type: filter.meta.type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class FilterEditorService {
* @param {Operator} newOperator - operator definition
*/
registerFilterOperator: filterOperatorRegistry.add,
}
};
}

public start() {
Expand All @@ -36,4 +36,4 @@ export class FilterEditorService {

/** @public types */
export { Operator };
export type FilterEditorSetup = ReturnType<FilterEditorService['setup']>;
export type FilterEditorSetup = ReturnType<FilterEditorService['setup']>;
Loading

0 comments on commit 2344db3

Please sign in to comment.