Skip to content

Commit

Permalink
fixing remaining karma tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Mar 25, 2020
1 parent db66f42 commit 5858afb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import { createRegionMapVisualization } from '../region_map_visualization';
import { createRegionMapTypeDefinition } from '../region_map_type';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis';
import { npSetup } from '../../../../ui/public/new_platform';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type';

const THRESHOLD = 0.45;
const PIXEL_DIFF = 96;
Expand All @@ -51,6 +52,7 @@ describe('RegionMapsVisualizationTests', function() {
let domNode;
let RegionMapsVisualization;
let vis;
let regionMapVisType;
let dependencies;

let imageComparator;
Expand Down Expand Up @@ -85,8 +87,6 @@ describe('RegionMapsVisualizationTests', function() {
],
};

let visRegComplete = false;

beforeEach(ngMock.module('kibana'));

let getManifestStub;
Expand All @@ -106,13 +106,7 @@ describe('RegionMapsVisualizationTests', function() {
uiSettings,
};

if (!visRegComplete) {
visRegComplete = true;
npSetup.plugins.visualizations.createBaseVisualization(
createRegionMapTypeDefinition(dependencies)
);
}

regionMapVisType = new BaseVisType(createRegionMapTypeDefinition(dependencies));
RegionMapsVisualization = createRegionMapVisualization(dependencies);

ChoroplethLayer.prototype._makeJsonAjaxCall = async function() {
Expand Down Expand Up @@ -157,7 +151,7 @@ describe('RegionMapsVisualizationTests', function() {
imageComparator = new ImageComparator();

vis = new ExprVis({
type: 'region_map',
type: regionMapVisType,
});

vis.params.bucket = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import { createTileMapVisualization } from '../tile_map_visualization';
import { createTileMapTypeDefinition } from '../tile_map_type';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis';
import { npSetup } from '../../../../ui/public/new_platform';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type';

function mockRawData() {
const stack = [dummyESResponse];
Expand All @@ -60,13 +61,13 @@ mockRawData();

const THRESHOLD = 0.45;
const PIXEL_DIFF = 64;
let visRegComplete = false;

describe('CoordinateMapsVisualizationTest', function() {
let domNode;
let CoordinateMapsVisualization;
let vis;
let dependencies;
let visType;

let imageComparator;

Expand All @@ -83,12 +84,7 @@ describe('CoordinateMapsVisualizationTest', function() {
$injector,
};

if (!visRegComplete) {
visRegComplete = true;
npSetup.plugins.visualizations.createBaseVisualization(
createTileMapTypeDefinition(dependencies)
);
}
visType = new BaseVisType(createTileMapTypeDefinition(dependencies));

CoordinateMapsVisualization = createTileMapVisualization(dependencies);

Expand Down Expand Up @@ -123,7 +119,7 @@ describe('CoordinateMapsVisualizationTest', function() {

imageComparator = new ImageComparator();
vis = new ExprVis({
type: 'tile_map',
type: visType,
});
vis.params = {
mapType: 'Scaled Circle Markers',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { npSetup } from '../../legacy_imports';
import { ImageComparator } from 'test_utils/image_comparator';
import { createTagCloudVisualization } from '../tag_cloud_visualization';
import basicdrawPng from './basicdraw.png';
Expand All @@ -31,10 +30,12 @@ import { ExprVis } from '../../../../../../plugins/visualizations/public/express
// Replace with mock when converting to jest tests
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { seedColors } from '../../../../../../plugins/charts/public/services/colors/seed_colors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { BaseVisType } from '../../../../../../plugins/visualizations/public/vis_types/base_vis_type';
import { createTagCloudVisTypeDefinition } from '../../tag_cloud_type';

const THRESHOLD = 0.65;
const PIXEL_DIFF = 64;
let visRegComplete = false;
describe('TagCloudVisualizationTest', function() {
let domNode;
let vis;
Expand Down Expand Up @@ -69,18 +70,11 @@ describe('TagCloudVisualizationTest', function() {

describe('TagCloudVisualization - basics', function() {
beforeEach(async function() {
const dependencies = {};
if (!visRegComplete) {
visRegComplete = true;
npSetup.plugins.visualizations.createBaseVisualization(
createTagCloudVisualization(dependencies)
);
}

const visType = new BaseVisType(createTagCloudVisTypeDefinition({ colors: seedColors }));
setupDOM('512px', '512px');
imageComparator = new ImageComparator();
vis = new ExprVis({
type: 'tagcloud',
type: visType,
params: {
bucket: { accessor: 0, format: {} },
metric: { accessor: 0, format: {} },
Expand Down

0 comments on commit 5858afb

Please sign in to comment.