BarGaugeMigrations.test.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { PanelModel } from '@grafana/ui';
  2. import { barGaugePanelMigrationHandler } from './BarGaugeMigrations';
  3. describe('BarGauge Panel Migrations', () => {
  4. it('from 6.2', () => {
  5. const panel = {
  6. id: 7,
  7. links: [],
  8. options: {
  9. displayMode: 'lcd',
  10. fieldOptions: {
  11. calcs: ['mean'],
  12. defaults: {
  13. decimals: null,
  14. max: -22,
  15. min: 33,
  16. unit: 'watt',
  17. },
  18. mappings: [],
  19. override: {},
  20. thresholds: [
  21. {
  22. color: 'green',
  23. index: 0,
  24. value: null,
  25. },
  26. {
  27. color: 'orange',
  28. index: 1,
  29. value: 40,
  30. },
  31. {
  32. color: 'red',
  33. index: 2,
  34. value: 80,
  35. },
  36. ],
  37. values: false,
  38. },
  39. orientation: 'vertical',
  40. },
  41. pluginVersion: '6.2.0',
  42. targets: [],
  43. title: 'Usage',
  44. type: 'bargauge',
  45. } as PanelModel;
  46. expect(barGaugePanelMigrationHandler(panel)).toMatchSnapshot();
  47. });
  48. });