mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Adds typings to lodash (#16590)
This commit is contained in:
@@ -4,7 +4,6 @@ jest.mock('app/core/store', () => {
|
||||
};
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
import _ from 'lodash';
|
||||
import config from 'app/core/config';
|
||||
import { DashboardExporter } from './DashboardExporter';
|
||||
@@ -148,7 +147,7 @@ describe('given dashboard with repeated panels', () => {
|
||||
});
|
||||
|
||||
it('should add datasource to required', () => {
|
||||
const require = _.find(exported.__requires, { name: 'TestDB' });
|
||||
const require: any = _.find(exported.__requires, { name: 'TestDB' });
|
||||
expect(require.name).toBe('TestDB');
|
||||
expect(require.id).toBe('testdb');
|
||||
expect(require.type).toBe('datasource');
|
||||
@@ -156,52 +155,52 @@ describe('given dashboard with repeated panels', () => {
|
||||
});
|
||||
|
||||
it('should not add built in datasources to required', () => {
|
||||
const require = _.find(exported.__requires, { name: 'Mixed' });
|
||||
const require: any = _.find(exported.__requires, { name: 'Mixed' });
|
||||
expect(require).toBe(undefined);
|
||||
});
|
||||
|
||||
it('should add datasources used in mixed mode', () => {
|
||||
const require = _.find(exported.__requires, { name: 'OtherDB' });
|
||||
const require: any = _.find(exported.__requires, { name: 'OtherDB' });
|
||||
expect(require).not.toBe(undefined);
|
||||
});
|
||||
|
||||
it('should add graph panel to required', () => {
|
||||
const require = _.find(exported.__requires, { name: 'Graph' });
|
||||
const require: any = _.find(exported.__requires, { name: 'Graph' });
|
||||
expect(require.name).toBe('Graph');
|
||||
expect(require.id).toBe('graph');
|
||||
expect(require.version).toBe('1.1.0');
|
||||
});
|
||||
|
||||
it('should add table panel to required', () => {
|
||||
const require = _.find(exported.__requires, { name: 'Table' });
|
||||
const require: any = _.find(exported.__requires, { name: 'Table' });
|
||||
expect(require.name).toBe('Table');
|
||||
expect(require.id).toBe('table');
|
||||
expect(require.version).toBe('1.1.1');
|
||||
});
|
||||
|
||||
it('should add heatmap panel to required', () => {
|
||||
const require = _.find(exported.__requires, { name: 'Heatmap' });
|
||||
const require: any = _.find(exported.__requires, { name: 'Heatmap' });
|
||||
expect(require.name).toBe('Heatmap');
|
||||
expect(require.id).toBe('heatmap');
|
||||
expect(require.version).toBe('1.1.2');
|
||||
});
|
||||
|
||||
it('should add grafana version', () => {
|
||||
const require = _.find(exported.__requires, { name: 'Grafana' });
|
||||
const require: any = _.find(exported.__requires, { name: 'Grafana' });
|
||||
expect(require.type).toBe('grafana');
|
||||
expect(require.id).toBe('grafana');
|
||||
expect(require.version).toBe('3.0.2');
|
||||
});
|
||||
|
||||
it('should add constant template variables as inputs', () => {
|
||||
const input = _.find(exported.__inputs, { name: 'VAR_PREFIX' });
|
||||
const input: any = _.find(exported.__inputs, { name: 'VAR_PREFIX' });
|
||||
expect(input.type).toBe('constant');
|
||||
expect(input.label).toBe('prefix');
|
||||
expect(input.value).toBe('collectd');
|
||||
});
|
||||
|
||||
it('should templatize constant variables', () => {
|
||||
const variable = _.find(exported.templating.list, { name: 'prefix' });
|
||||
const variable: any = _.find(exported.templating.list, { name: 'prefix' });
|
||||
expect(variable.query).toBe('${VAR_PREFIX}');
|
||||
expect(variable.current.text).toBe('${VAR_PREFIX}');
|
||||
expect(variable.current.value).toBe('${VAR_PREFIX}');
|
||||
@@ -210,7 +209,7 @@ describe('given dashboard with repeated panels', () => {
|
||||
});
|
||||
|
||||
it('should add datasources only use via datasource variable to requires', () => {
|
||||
const require = _.find(exported.__requires, { name: 'OtherDB_2' });
|
||||
const require: any = _.find(exported.__requires, { name: 'OtherDB_2' });
|
||||
expect(require.id).toBe('other2');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-ignore
|
||||
import _ from 'lodash';
|
||||
|
||||
import config from 'app/core/config';
|
||||
|
||||
Reference in New Issue
Block a user