mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Elasticsearch: remove usages of any
* Elasticsearch: check for filter type when accessing field aggs
* Elasticsearch: use type guards instead of checking types
* Use unknown for isPrimitive function
* Add deprecation notice
* Remove unused type
* Fix bug in "isPrimitive" function
* Remove unused import
* Revert "Fix bug in "isPrimitive" function"
This reverts commit 27f9874cce.
24 lines
610 B
TypeScript
24 lines
610 B
TypeScript
import { Count, ExtendedStats } from './dataquery.gen';
|
|
import { isMetricAggregationWithMeta } from './guards';
|
|
|
|
describe('Type guards', () => {
|
|
test('Identifies metrics with meta attribute', () => {
|
|
const metric: ExtendedStats = {
|
|
id: 'test',
|
|
type: 'extended_stats',
|
|
meta: {
|
|
test: 'test',
|
|
},
|
|
};
|
|
expect(isMetricAggregationWithMeta(metric)).toBe(true);
|
|
});
|
|
|
|
test('Identifies metrics without meta attribute', () => {
|
|
const metric: Count = {
|
|
id: 'test',
|
|
type: 'count',
|
|
};
|
|
expect(isMetricAggregationWithMeta(metric)).toBe(false);
|
|
});
|
|
});
|