recfactor: added unit test for the new scenario, #8143

This commit is contained in:
Torkel Ödegaard
2017-04-18 16:30:20 +02:00
parent a64e000f1a
commit 85baa50194
2 changed files with 25 additions and 5 deletions

View File

@@ -186,4 +186,24 @@ describe('GraphiteQueryCtrl', function() {
expect(ctx.ctrl.target.targetFull).to.be('scaleToSeconds(nested.query.count)');
});
});
describe('when updating target used in other query', function() {
beforeEach(function() {
ctx.ctrl.target.target = 'metrics.a.count';
ctx.ctrl.target.refId = 'A';
ctx.ctrl.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([{expandable: false}]));
ctx.ctrl.parseTarget();
ctx.ctrl.panelCtrl.panel.targets = [
ctx.ctrl.target, {target: 'sumSeries(#A)', refId: 'B'}
];
ctx.ctrl.updateModelTarget();
});
it('targetFull of other query should update', function() {
expect(ctx.ctrl.panel.targets[1].targetFull).to.be('sumSeries(metrics.a.count)');
});
});
});