From 75c4c4d8b503815de13eb6772e304d6e24bf6eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 8 Sep 2017 13:52:28 +0200 Subject: [PATCH] fix: query ctrl unit tests now pass as before --- .../plugins/datasource/graphite/specs/query_ctrl_specs.ts | 5 +++++ .../plugins/datasource/influxdb/specs/query_ctrl_specs.ts | 8 ++++++-- .../plugins/datasource/opentsdb/specs/query-ctrl-specs.ts | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index e88fbc044c1..ff1ea9449ee 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -24,6 +24,11 @@ describe('GraphiteQueryCtrl', function() { ctx.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'}; ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); ctx.panelCtrl = {panel: {}}; + ctx.panelCtrl = { + panel: { + targets: [ctx.target] + } + }; ctx.panelCtrl.refresh = sinon.spy(); ctx.ctrl = $controller(GraphiteQueryCtrl, {$scope: ctx.scope}, { diff --git a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts index 44b593edc0e..ec433249097 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts @@ -19,9 +19,13 @@ describe('InfluxDBQueryCtrl', function() { ctx.$q = $q; ctx.scope = $rootScope.$new(); ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); - ctx.panelCtrl = {panel: {}}; - ctx.panelCtrl.refresh = sinon.spy(); ctx.target = {target: {}}; + ctx.panelCtrl = { + panel: { + targets: [ctx.target] + } + }; + ctx.panelCtrl.refresh = sinon.spy(); ctx.ctrl = $controller(InfluxQueryCtrl, {$scope: ctx.scope}, { panelCtrl: ctx.panelCtrl, target: ctx.target, diff --git a/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts b/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts index 644af1e7bf7..0d3a44858f4 100644 --- a/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts +++ b/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts @@ -18,7 +18,11 @@ describe('OpenTsQueryCtrl', function() { ctx.$q = $q; ctx.scope = $rootScope.$new(); ctx.target = {target: ''}; - ctx.panelCtrl = {panel: {}}; + ctx.panelCtrl = { + panel: { + targets: [ctx.target] + } + }; ctx.panelCtrl.refresh = sinon.spy(); ctx.datasource.getAggregators = sinon.stub().returns(ctx.$q.when([])); ctx.datasource.getFilterTypes = sinon.stub().returns(ctx.$q.when([]));