Skip to content

Commit

Permalink
Fix Jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-lapata committed Dec 2, 2019
1 parent e0f3fb2 commit c07fad3
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import { Vis } from '../../visualizations/public';
import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy';
// eslint-disable-next-line
import { stubFields } from '../../../../plugins/data/public/stubs';
// eslint-disable-next-line
import { setFieldFormats } from '../../../../plugins/data/public/index_patterns/services';

interface TableVisScope extends IScope {
[key: string]: any;
Expand Down Expand Up @@ -78,13 +80,7 @@ describe('Table Vis - Controller', () => {
let $el: JQuery<HTMLElement>;
let tableAggResponse: any;
let tabifiedResponse: any;
const stubIndexPattern = new StubIndexPattern(
'logstash-*',
(cfg: any) => cfg,
'time',
stubFields,
npStart.core.uiSettings
);
let stubIndexPattern: any;

const initLocalAngular = () => {
const tableVisModule = getAngularModule('kibana/table_vis', npStart.core);
Expand All @@ -105,6 +101,19 @@ describe('Table Vis - Controller', () => {
})
);

beforeEach(() => {
setFieldFormats(({
getDefaultInstance: jest.fn(),
} as unknown) as any);
stubIndexPattern = new StubIndexPattern(
'logstash-*',
(cfg: any) => cfg,
'time',
stubFields,
npStart.core.uiSettings
);
});

function getRangeVis(params?: object) {
// @ts-ignore
return new Vis(stubIndexPattern, {
Expand Down

0 comments on commit c07fad3

Please sign in to comment.