|
|
@@ -13,7 +13,11 @@ describe('grafana data source', () => {
|
|
|
};
|
|
|
|
|
|
const templateSrvStub = {
|
|
|
- replace: val => val.replace('$var', 'replaced')
|
|
|
+ replace: val => {
|
|
|
+ return val
|
|
|
+ .replace('$var2', 'replaced|replaced2')
|
|
|
+ .replace('$var', 'replaced');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const ds = new GrafanaDatasource(backendSrvStub, q, templateSrvStub);
|
|
|
@@ -32,6 +36,21 @@ describe('grafana data source', () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('with tags that have multi value template variables', () => {
|
|
|
+ const options = setupAnnotationQueryOptions(
|
|
|
+ {tags: ['$var2']}
|
|
|
+ );
|
|
|
+
|
|
|
+ beforeEach(() => {
|
|
|
+ return ds.annotationQuery(options);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should interpolate template variables in tags in query options', () => {
|
|
|
+ expect(calledBackendSrvParams.tags[0]).toBe('replaced');
|
|
|
+ expect(calledBackendSrvParams.tags[1]).toBe('replaced2');
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
describe('with type dashboard', () => {
|
|
|
const options = setupAnnotationQueryOptions(
|
|
|
{
|