The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/public/app/features/dashboard-scene/utils/PanelModelCompatibilityWrap...

30 lines
926 B

import { VizPanel } from '@grafana/scenes';
import { LibraryPanelBehavior } from '../scene/LibraryPanelBehavior';
import { PanelModelCompatibilityWrapper } from './PanelModelCompatibilityWrapper';
describe('PanelModelCompatibilityWrapper', () => {
it('Can get legacy id', () => {
const vizPanel = new VizPanel({ pluginId: 'test', title: 'test', description: 'test', key: 'panel-24' });
const panelModel = new PanelModelCompatibilityWrapper(vizPanel);
expect(panelModel.id).toBe(24);
});
it('Can get legacy id for lib panel', () => {
const panel = new VizPanel({ pluginId: 'test', title: 'test', description: 'test', key: 'panel-24' });
const libPanel = new LibraryPanelBehavior({
uid: 'a',
name: 'aa',
});
panel.setState({
$behaviors: [libPanel],
});
const panelModel = new PanelModelCompatibilityWrapper(panel);
expect(panelModel.id).toBe(24);
});
});