Skip to content

Commit

Permalink
Fix jest test paths. Fix TS lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Apr 17, 2020
1 parent dff7bc6 commit 737311e
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import { npSetup, npStart } from 'ui/new_platform';
import {
bindSetupCoreAndPlugins,
bindStartCoreAndPlugins,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../plugins/maps/public/plugin';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MAP_SAVED_OBJECT_TYPE } from '../../../../../plugins/maps/common/constants';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { MapEmbeddableFactory } from '../../../../../plugins/maps/public/embeddable';

bindSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/maps/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'uiExports/embeddableActions';

import 'ui/autoload/all';
import 'react-vis/dist/style.css';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import '../../../../plugins/maps/public/angular/services/gis_map_saved_object_loader';
import './angular/map_controller';
import './routes';
Expand Down
3 changes: 1 addition & 2 deletions x-pack/legacy/plugins/maps/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import { npSetup, npStart } from 'ui/new_platform';
// @ts-ignore Untyped Module
import { uiModules } from 'ui/modules';
import { PluginInitializerContext } from 'kibana/public'; // eslint-disable-line import/order
import { plugin } from '.';

const pluginInstance = plugin({} as PluginInitializerContext);
const pluginInstance = plugin();

const setupPlugins = {
__LEGACY: {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
// @ts-ignore
import { wrapInI18nContext } from 'ui/i18n';
// @ts-ignore
import { MapListing } from '../../../../plugins/maps/public/components/map_listing';
import { MapListing } from '../../../../plugins/maps/public/components/map_listing'; // eslint-disable-line @kbn/eslint/no-restricted-paths
// @ts-ignore
import {
bindSetupCoreAndPlugins as bindNpSetupCoreAndPlugins,
Expand Down
3 changes: 3 additions & 0 deletions x-pack/legacy/plugins/maps/public/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

import { i18n } from '@kbn/i18n';
import routes from 'ui/routes';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import listingTemplate from '../../../../plugins/maps/public/angular/listing_ng_wrapper.html';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import mapTemplate from '../../../../plugins/maps/public/angular/map.html';
import {
getSavedObjectsClient,
getCoreChrome,
getMapsCapabilities,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../plugins/maps/public/kibana_services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getMapsSavedObjectLoader } from '../../../../plugins/maps/public/angular/services/gis_map_saved_object_loader';

routes.enable();
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/actions/map_actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

jest.mock('../selectors/map_selectors', () => ({}));
jest.mock('../../../../../plugins/maps/public/kibana_services', () => ({}));
jest.mock('../kibana_services', () => ({}));

import { mapExtentChanged, setMouseCoordinates } from './map_actions';

Expand Down
11 changes: 11 additions & 0 deletions x-pack/plugins/maps/public/actions/ui_actions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@

import { AnyAction } from 'redux';

export const UPDATE_FLYOUT: string;
export const CLOSE_SET_VIEW: string;
export const OPEN_SET_VIEW: string;
export const SET_IS_LAYER_TOC_OPEN: string;
export const SET_FULL_SCREEN: string;
export const SET_READ_ONLY: string;
export const SET_OPEN_TOC_DETAILS: string;
export const SHOW_TOC_DETAILS: string;
export const HIDE_TOC_DETAILS: string;
export const UPDATE_INDEXING_STAGE: string;

export function setOpenTOCDetails(layerIds?: string[]): AnyAction;

export function setIsLayerTOCOpen(open: boolean): AnyAction;
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.
*/

jest.mock('../../../../../../../../plugins/maps/public/components/metric_editor', () => ({
jest.mock('../../../../components/metric_editor', () => ({
MetricsEditor: () => {
return <div>mockMetricsEditor</div>;
},
Expand Down
12 changes: 9 additions & 3 deletions x-pack/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ import {
// @ts-ignore
} from './kibana_services';
import { featureCatalogueEntry } from './feature_catalogue_entry';
// @ts-ignore
import { getMapsVisTypeAlias } from './maps_vis_type_alias';
import { registerLayerWizards } from './layers/load_layer_wizards';
import { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
import { VisualizationsSetup } from '../../../../src/plugins/visualizations/public';

export interface MapsPluginSetupDependencies {
inspector: InspectorSetupContract;
home: HomePublicPluginSetup;
visualizations: VisualizationsSetup;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface MapsPluginStartDependencies {}
Expand Down Expand Up @@ -96,11 +101,12 @@ export class MapsPlugin
MapsPluginStartDependencies
> {
public setup(core: CoreSetup, plugins: MapsPluginSetupDependencies) {
const { inspector, home, visualizations } = plugins;
bindSetupCoreAndPlugins(core, plugins);

plugins.inspector.registerView(MapView);
plugins.home.featureCatalogue.register(featureCatalogueEntry);
plugins.visualizations.registerAlias(getMapsVisTypeAlias());
inspector.registerView(MapView);
home.featureCatalogue.register(featureCatalogueEntry);
visualizations.registerAlias(getMapsVisTypeAlias());
}

public start(core: CoreStart, plugins: any) {
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/maps/public/reducers/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
SHOW_TOC_DETAILS,
HIDE_TOC_DETAILS,
UPDATE_INDEXING_STAGE,
// @ts-ignore
} from '../actions/ui_actions';

export enum FLYOUT_STATE {
Expand Down
16 changes: 8 additions & 8 deletions x-pack/plugins/maps/public/selectors/map_selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('../../../../../plugins/maps/public/layers/vector_layer', () => {});
jest.mock('../../../../../plugins/maps/public/layers/tiled_vector_layer', () => {});
jest.mock('../../../../../plugins/maps/public/layers/blended_vector_layer', () => {});
jest.mock('../../../../../plugins/maps/public/layers/heatmap_layer', () => {});
jest.mock('../../../../../plugins/maps/public/layers/vector_tile_layer', () => {});
jest.mock('../../../../../plugins/maps/public/layers/joins/inner_join', () => {});
jest.mock('../../../../../plugins/maps/public/reducers/non_serializable_instances', () => ({
jest.mock('../layers/vector_layer', () => {});
jest.mock('../layers/tiled_vector_layer', () => {});
jest.mock('../layers/blended_vector_layer', () => {});
jest.mock('../layers/heatmap_layer', () => {});
jest.mock('../layers/vector_tile_layer', () => {});
jest.mock('../layers/joins/inner_join', () => {});
jest.mock('../reducers/non_serializable_instances', () => ({
getInspectorAdapters: () => {
return {};
},
}));
jest.mock('../../../../../plugins/maps/public/kibana_services', () => ({
jest.mock('../kibana_services', () => ({
getTimeFilter: () => ({
getTime: () => {
return {
Expand Down

0 comments on commit 737311e

Please sign in to comment.