fix TriggerPanelCtrl tests

This commit is contained in:
Alexander Zobnin
2020-05-12 19:12:41 +03:00
parent 72b739f4cb
commit f7105d9f06
5 changed files with 294 additions and 278 deletions

View File

@@ -2,7 +2,7 @@
/* globals global: false */
import { JSDOM } from 'jsdom';
import { PanelCtrl } from './panelStub';
import { PanelCtrl, MetricsPanelCtrl } from './panelStub';
// Mock Grafana modules that are not available outside of the core project
// Required for loading module.js
@@ -24,12 +24,19 @@ jest.mock('grafana/app/core/core_module', () => {
};
}, {virtual: true});
let mockPanelCtrl = PanelCtrl;
jest.mock('grafana/app/core/core', () => ({
contextSrv: {},
}), {virtual: true});
const mockPanelCtrl = PanelCtrl;
const mockMetricsPanelCtrl = MetricsPanelCtrl;
jest.mock('grafana/app/plugins/sdk', () => {
return {
QueryCtrl: null,
loadPluginCss: () => {},
PanelCtrl: mockPanelCtrl
PanelCtrl: mockPanelCtrl,
MetricsPanelCtrl: mockMetricsPanelCtrl,
};
}, {virtual: true});