Basic cleanup
This commit is contained in:
@@ -22,7 +22,7 @@ describe('ElasticDatasource', function() {
|
|||||||
|
|
||||||
let timeSrv = {
|
let timeSrv = {
|
||||||
time: { from: 'now-1h', to: 'now' },
|
time: { from: 'now-1h', to: 'now' },
|
||||||
timeRange: jest.fn(parse => {
|
timeRange: jest.fn(() => {
|
||||||
return {
|
return {
|
||||||
from: dateMath.parse(this.time.from, false),
|
from: dateMath.parse(this.time.from, false),
|
||||||
to: dateMath.parse(this.time.to, true),
|
to: dateMath.parse(this.time.to, true),
|
||||||
|
|||||||
@@ -195,43 +195,6 @@ export function TemplateSrvStub() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function jestTemplateSrvStub() {
|
|
||||||
this.variables = [];
|
|
||||||
this.templateSettings = { interpolate: /\[\[([\s\S]+?)\]\]/g };
|
|
||||||
this.data = {};
|
|
||||||
this.replace = jest.fn(text => _.template(text, this.templateSettings)(this.data));
|
|
||||||
this.init = jest.fn();
|
|
||||||
this.getAdhocFilters = jest.fn(() => []);
|
|
||||||
this.fillVariableValuesForUrl = jest.fn();
|
|
||||||
this.updateTemplateData = jest.fn();
|
|
||||||
this.variableExists = jest.fn(() => false);
|
|
||||||
this.variableInitialized = jest.fn();
|
|
||||||
this.highlightVariablesAsHtml = jest.fn(str => str);
|
|
||||||
this.setGrafanaVariable = jest.fn((name, value) => {
|
|
||||||
this.data[name] = value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function jestTimeSrvStub() {
|
|
||||||
this.init = jest.fn();
|
|
||||||
this.time = { from: 'now-1h', to: 'now' };
|
|
||||||
this.timeRange = jest.fn(parse => {
|
|
||||||
if (parse === false) {
|
|
||||||
return this.time;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
from: dateMath.parse(this.time.from, false),
|
|
||||||
to: dateMath.parse(this.time.to, true),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
this.replace = jest.fn(target => target);
|
|
||||||
|
|
||||||
this.setTime = jest.fn(time => {
|
|
||||||
this.time = time;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var allDeps = {
|
var allDeps = {
|
||||||
ContextSrvStub,
|
ContextSrvStub,
|
||||||
TemplateSrvStub,
|
TemplateSrvStub,
|
||||||
@@ -239,8 +202,6 @@ var allDeps = {
|
|||||||
ControllerTestContext,
|
ControllerTestContext,
|
||||||
ServiceTestContext,
|
ServiceTestContext,
|
||||||
DashboardViewStateStub,
|
DashboardViewStateStub,
|
||||||
jestTimeSrvStub,
|
|
||||||
jestTemplateSrvStub,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// for legacy
|
// for legacy
|
||||||
|
|||||||
Reference in New Issue
Block a user