Skip to content

Commit

Permalink
Fix build pipeline unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Jun 17, 2020
1 parent 0548a74 commit c0c8053
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions src/plugins/visualizations/public/legacy/build_pipeline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from './build_pipeline';
import { Vis } from '..';
import { dataPluginMock } from '../../../../plugins/data/public/mocks';
import { IAggConfig } from '../../../../plugins/data/public';
import { IndexPattern, IAggConfigs } from '../../../../plugins/data/public';

describe('visualize loader pipeline helpers: build pipeline', () => {
describe('prepareJson', () => {
Expand Down Expand Up @@ -344,23 +344,20 @@ describe('visualize loader pipeline helpers: build pipeline', () => {
describe('buildVislibDimensions', () => {
const dataStart = dataPluginMock.createStartContract();

let aggs: IAggConfig[];
let aggs: IAggConfigs;
let vis: Vis;
let params: any;

beforeEach(() => {
aggs = [
aggs = dataStart.search.aggs.createAggConfigs({} as IndexPattern, [
{
id: '0',
enabled: true,
type: {
type: 'metrics',
name: 'count',
},
type: 'count',
schema: 'metric',
params: {},
} as IAggConfig,
];
},
]);

params = {
searchSource: null,
Expand Down Expand Up @@ -393,11 +390,7 @@ describe('visualize loader pipeline helpers: build pipeline', () => {
],
},
data: {
aggs: {
getResponseAggs: () => {
return aggs;
},
} as any,
aggs,
searchSource: {} as any,
},
isHierarchical: () => {
Expand All @@ -422,8 +415,13 @@ describe('visualize loader pipeline helpers: build pipeline', () => {
});

it('with two numeric metrics, mixed normal and percent mode should have corresponding formatters', async () => {
const aggConfig = aggs[0];
aggs = [{ ...aggConfig } as IAggConfig, { ...aggConfig, id: '5' } as IAggConfig];
aggs.createAggConfig({
id: '5',
enabled: true,
type: 'count',
schema: 'metric',
params: {},
});

vis.params = {
seriesParams: [
Expand Down Expand Up @@ -469,11 +467,7 @@ describe('visualize loader pipeline helpers: build pipeline', () => {
},
params: { gauge: {} },
data: {
aggs: {
getResponseAggs: () => {
return aggs;
},
} as any,
aggs,
searchSource: {} as any,
},
isHierarchical: () => {
Expand Down

0 comments on commit c0c8053

Please sign in to comment.