mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
20 lines
638 B
TypeScript
20 lines
638 B
TypeScript
|
import { queryMetricTree } from './metricTree';
|
||
|
|
||
|
describe('MetricTree', () => {
|
||
|
it('queryMetric tree return right tree nodes', () => {
|
||
|
const nodes = queryMetricTree('*');
|
||
|
expect(nodes[0].children[0].name).toBe('AA');
|
||
|
expect(nodes[0].children[1].name).toBe('AB');
|
||
|
});
|
||
|
|
||
|
it('queryMetric tree return right tree nodes', () => {
|
||
|
const nodes = queryMetricTree('A.AB.ABC.*');
|
||
|
expect(nodes[0].name).toBe('ABCA');
|
||
|
});
|
||
|
|
||
|
it('queryMetric tree supports glob paths', () => {
|
||
|
const nodes = queryMetricTree('A.{AB,AC}.*').map(i => i.name);
|
||
|
expect(nodes).toEqual(['ABA', 'ABB', 'ABC', 'ACA', 'ACB', 'ACC']);
|
||
|
});
|
||
|
});
|