Skip to content

Commit b620c74

Browse files
committed
test(query_editor): adds test for nesting queries in targetFull
1 parent bd20dc6 commit b620c74

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,27 @@ describe('GraphiteQueryCtrl', function() {
160160
expect(ctx.panelCtrl.refresh.called).to.be(true);
161161
});
162162
});
163+
164+
describe('when updating targets with nested query', function() {
165+
beforeEach(function() {
166+
ctx.ctrl.target.target = 'scaleToSeconds(#A)';
167+
ctx.ctrl.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([{expandable: false}]));
168+
ctx.ctrl.parseTarget();
169+
170+
ctx.ctrl.panelCtrl.panel.targets = [ {
171+
target: 'nested.query.count',
172+
refId: 'A'
173+
}];
174+
175+
ctx.ctrl.updateModelTarget();
176+
});
177+
178+
it('target should remain the same', function() {
179+
expect(ctx.ctrl.target.target).to.be('scaleToSeconds(#A)');
180+
});
181+
182+
it('targetFull should include nexted queries', function() {
183+
expect(ctx.ctrl.target.targetFull).to.be('scaleToSeconds(nested.query.count)');
184+
});
185+
});
163186
});

0 commit comments

Comments
 (0)