Chore: reduces circular dependencies for variables/utils.ts (#44087)

* Chore: move constants to own file

* Chore: moves safe* functions to grafana/data

* Chore: moves safe* functions to grafana/data

* Chore: adds VariableQueryEditorProps and deprecates VariableQueryProps

* Chore: remove getDefaultVariableAdapters function

* Chore: moves transaction status to types

* Chore: fix tests that do not initialise TemplateSrv

* Chore: change space when stringifying

* Chore: revert safe* func move

* Chore: remove circular dependency in Explore utils
This commit is contained in:
Hugo Häggmark
2022-01-17 12:48:26 +01:00
committed by GitHub
parent aa00af8f2d
commit 4b4afc7b2c
42 changed files with 136 additions and 142 deletions

View File

@@ -1,8 +1,10 @@
import React from 'react';
import { DebugSection } from './DebugSection';
import { mount } from 'enzyme';
import { getLinkSrv, LinkService, LinkSrv, setLinkSrv } from '../../../../features/panel/panellinks/link_srv';
import { dateTime } from '@grafana/data';
import { setTemplateSrv } from '@grafana/runtime';
import { DebugSection } from './DebugSection';
import { getLinkSrv, LinkService, LinkSrv, setLinkSrv } from '../../../../features/panel/panellinks/link_srv';
// We do not need more here and TimeSrv is hard to setup fully.
jest.mock('app/features/dashboard/services/TimeSrv', () => ({
@@ -25,6 +27,17 @@ describe('DebugSection', () => {
setLinkSrv(linkService);
});
beforeEach(() => {
setTemplateSrv({
replace(target, scopedVars, format) {
return target ?? '';
},
getVariables() {
return [];
},
});
});
afterAll(() => {
setLinkSrv(originalLinkSrv);
});
@@ -67,6 +80,6 @@ describe('DebugSection', () => {
expect(wrapper.find('table').length).toBe(1);
// 3 rows + one header
expect(wrapper.find('tr').length).toBe(4);
expect(wrapper.find('tr').at(1).contains('http://localhost/trace/1234')).toBeTruthy();
expect(wrapper.find('tr').at(1).contains('http://localhost/trace/${__value.raw}')).toBeTruthy();
});
});