Commit 75c4c4d8 by Torkel Ödegaard

fix: query ctrl unit tests now pass as before

parent 2953d644
...@@ -24,6 +24,11 @@ describe('GraphiteQueryCtrl', function() { ...@@ -24,6 +24,11 @@ describe('GraphiteQueryCtrl', function() {
ctx.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'}; ctx.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'};
ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
ctx.panelCtrl = {panel: {}}; ctx.panelCtrl = {panel: {}};
ctx.panelCtrl = {
panel: {
targets: [ctx.target]
}
};
ctx.panelCtrl.refresh = sinon.spy(); ctx.panelCtrl.refresh = sinon.spy();
ctx.ctrl = $controller(GraphiteQueryCtrl, {$scope: ctx.scope}, { ctx.ctrl = $controller(GraphiteQueryCtrl, {$scope: ctx.scope}, {
......
...@@ -19,9 +19,13 @@ describe('InfluxDBQueryCtrl', function() { ...@@ -19,9 +19,13 @@ describe('InfluxDBQueryCtrl', function() {
ctx.$q = $q; ctx.$q = $q;
ctx.scope = $rootScope.$new(); ctx.scope = $rootScope.$new();
ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
ctx.panelCtrl = {panel: {}};
ctx.panelCtrl.refresh = sinon.spy();
ctx.target = {target: {}}; ctx.target = {target: {}};
ctx.panelCtrl = {
panel: {
targets: [ctx.target]
}
};
ctx.panelCtrl.refresh = sinon.spy();
ctx.ctrl = $controller(InfluxQueryCtrl, {$scope: ctx.scope}, { ctx.ctrl = $controller(InfluxQueryCtrl, {$scope: ctx.scope}, {
panelCtrl: ctx.panelCtrl, panelCtrl: ctx.panelCtrl,
target: ctx.target, target: ctx.target,
......
...@@ -18,7 +18,11 @@ describe('OpenTsQueryCtrl', function() { ...@@ -18,7 +18,11 @@ describe('OpenTsQueryCtrl', function() {
ctx.$q = $q; ctx.$q = $q;
ctx.scope = $rootScope.$new(); ctx.scope = $rootScope.$new();
ctx.target = {target: ''}; ctx.target = {target: ''};
ctx.panelCtrl = {panel: {}}; ctx.panelCtrl = {
panel: {
targets: [ctx.target]
}
};
ctx.panelCtrl.refresh = sinon.spy(); ctx.panelCtrl.refresh = sinon.spy();
ctx.datasource.getAggregators = sinon.stub().returns(ctx.$q.when([])); ctx.datasource.getAggregators = sinon.stub().returns(ctx.$q.when([]));
ctx.datasource.getFilterTypes = sinon.stub().returns(ctx.$q.when([])); ctx.datasource.getFilterTypes = sinon.stub().returns(ctx.$q.when([]));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment