Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Mar 3, 2021
1 parent acda74a commit 846af7d
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
*/

import { createSavedSearchesLoader } from '../../../../discover/public';
import type { VisualizeInput } from 'src/plugins/visualizations/public';
import type {
VisualizeInput,
VisSavedObject,
Vis,
VisParams,
} from 'src/plugins/visualizations/public';
import {
getVisualizationInstance,
getVisualizationInstanceFromInput,
Expand All @@ -29,8 +34,8 @@ describe('getVisualizationInstance', () => {
const serializedVisMock = {
type: 'area',
};
let savedVisMock: any;
let visMock: any;
let savedVisMock: VisSavedObject;
let visMock: Vis<VisParams>;
let mockServices: jest.Mocked<VisualizeServices>;
let subj: BehaviorSubject<any>;

Expand All @@ -40,8 +45,8 @@ describe('getVisualizationInstance', () => {
visMock = {
type: {},
data: {},
};
savedVisMock = {};
} as Vis<VisParams>;
savedVisMock = {} as VisSavedObject;
// @ts-expect-error
mockServices.data.search.showError.mockImplementation(() => {});
// @ts-expect-error
Expand Down Expand Up @@ -89,6 +94,7 @@ describe('getVisualizationInstance', () => {

test('should load existing vis by id and call vis type setup if exists', async () => {
const newVisObj = { data: {} };
// @ts-expect-error
visMock.type.setup = jest.fn(() => newVisObj);
const { vis } = await getVisualizationInstance(mockServices, 'saved_vis_id');

Expand Down Expand Up @@ -122,8 +128,8 @@ describe('getVisualizationInstanceInput', () => {
const serializedVisMock = {
type: 'pie',
};
let savedVisMock: any;
let visMock: any;
let savedVisMock: VisSavedObject;
let visMock: Vis<VisParams>;
let mockServices: jest.Mocked<VisualizeServices>;
let subj: BehaviorSubject<any>;

Expand All @@ -133,8 +139,8 @@ describe('getVisualizationInstanceInput', () => {
visMock = {
type: {},
data: {},
};
savedVisMock = {};
} as Vis<VisParams>;
savedVisMock = {} as VisSavedObject;
// @ts-expect-error
mockServices.savedVisualizations.get.mockImplementation(() => savedVisMock);
// @ts-expect-error
Expand Down

0 comments on commit 846af7d

Please sign in to comment.