mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { PanelPluginMeta, escapeStringForRegex } from '@grafana/data';
|
|
|
|
import { filterPluginList } from './util';
|
|
|
|
describe('panel state utils', () => {
|
|
it('should include timeseries in a graph query', async () => {
|
|
const pluginsList: PanelPluginMeta[] = [
|
|
{ id: 'graph', name: 'Graph (old)' } as any,
|
|
{ id: 'timeseries', name: 'Graph (old)' },
|
|
{ id: 'timeline', name: 'Timeline' },
|
|
];
|
|
const found = filterPluginList(pluginsList, escapeStringForRegex('gra'), { id: 'xyz' } as any);
|
|
expect(found.map((v) => v.id)).toEqual(['graph', 'timeseries']);
|
|
});
|
|
|
|
it('should handle escaped regex characters in the search query (e.g. -)', async () => {
|
|
const pluginsList: PanelPluginMeta[] = [
|
|
{ id: 'graph', name: 'Graph (old)' } as any,
|
|
{ id: 'timeseries', name: 'Graph (old)' },
|
|
{ id: 'timeline', name: 'Timeline' },
|
|
{ id: 'panelwithdashes', name: 'Panel-With-Dashes' },
|
|
];
|
|
const found = filterPluginList(pluginsList, escapeStringForRegex('panel-'), { id: 'xyz' } as any);
|
|
expect(found.map((v) => v.id)).toEqual(['panelwithdashes']);
|
|
});
|
|
});
|