Skip to content

Commit

Permalink
Mock services
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-lapata committed Apr 21, 2020
1 parent 43abc6c commit 5d015b7
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import ngMock from 'ng_mock';
import $ from 'jquery';
// Will be replaced with new path when tests are moved
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createVegaVisualization } from '../../../../../../../plugins/vis_type_vega/public/vega_visualization';
import { createVegaVisualization } from '../../../../../../plugins/vis_type_vega/public/vega_visualization';
import { ImageComparator } from 'test_utils/image_comparator';

import vegaliteGraph from '!!raw-loader!./vegalite_graph.hjson';
Expand All @@ -39,30 +39,32 @@ import vegaMapGraph from '!!raw-loader!./vega_map_test.hjson';
import vegaMapImage256 from './vega_map_image_256.png';
// Will be replaced with new path when tests are moved
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { VegaParser } from '../../../../../../../plugins/vis_type_vega/public/data_model/vega_parser';
import { VegaParser } from '../../../../../../plugins/vis_type_vega/public/data_model/vega_parser';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { SearchCache } from '../../../../../../../plugins/vis_type_vega/public/data_model/search_cache';
import { SearchCache } from '../../../../../../plugins/vis_type_vega/public/data_model/search_cache';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createVegaTypeDefinition } from '../../../../../../../plugins/vis_type_vega/public/vega_type';
import { createVegaTypeDefinition } from '../../../../../../plugins/vis_type_vega/public/vega_type';
// TODO This is an integration test and thus requires a running platform. When moving to the new platform,
// this test has to be migrated to the newly created integration test environment.
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { npStart } from 'ui/new_platform';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { BaseVisType } from '../../../../../../../plugins/visualizations/public/vis_types/base_vis_type';
import { BaseVisType } from '../../../../../../plugins/visualizations/public/vis_types/base_vis_type';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ExprVis } from '../../../../../../../plugins/visualizations/public/expressions/vis';
import { ExprVis } from '../../../../../../plugins/visualizations/public/expressions/vis';

import {
setInjectedVars,
setData,
setSavedObjects,
setNotifications,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../../plugins/vis_type_vega/public/services';
} from '../../../../../../plugins/vis_type_vega/public/services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { setInjectedVarFunc } from '../../../../../../../plugins/maps_legacy/public/kibana_services';
import { setInjectedVarFunc } from '../../../../../../plugins/maps_legacy/public/kibana_services';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ServiceSettings } from '../../../../../../../plugins/maps_legacy/public/map/service_settings';
import { ServiceSettings } from '../../../../../../plugins/maps_legacy/public/map/service_settings';

const THRESHOLD = 0.1;
const PIXEL_DIFF = 30;
Expand All @@ -80,9 +82,11 @@ describe('VegaVisualizations', () => {
enableExternalUrls: true,
esShardTimeout: 10000,
});
setData(npStart.plugins.data);
setSavedObjects(npStart.core.savedObjects);
setNotifications(npStart.core.notifications);

beforeEach(ngMock.module('kibana'));
beforeEach(setData(npStart.plugins.data));
beforeEach(
ngMock.inject(() => {
setInjectedVarFunc(injectedVar => {
Expand Down

0 comments on commit 5d015b7

Please sign in to comment.