GaugeMigrations.test.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import { PanelModel } from '@grafana/ui';
  2. import { gaugePanelMigrationCheck } from './GaugeMigrations';
  3. describe('Gauge Panel Migrations', () => {
  4. it('from 6.1.1', () => {
  5. const panel = {
  6. datasource: '-- Grafana --',
  7. gridPos: {
  8. h: 9,
  9. w: 12,
  10. x: 0,
  11. y: 0,
  12. },
  13. id: 2,
  14. options: {
  15. maxValue: '50',
  16. minValue: '-50',
  17. orientation: 'auto',
  18. showThresholdLabels: true,
  19. showThresholdMarkers: true,
  20. thresholds: [
  21. {
  22. color: 'green',
  23. index: 0,
  24. value: null,
  25. },
  26. {
  27. color: '#EAB839',
  28. index: 1,
  29. value: -25,
  30. },
  31. {
  32. color: '#6ED0E0',
  33. index: 2,
  34. value: 0,
  35. },
  36. {
  37. color: 'red',
  38. index: 3,
  39. value: 25,
  40. },
  41. ],
  42. valueMappings: [
  43. {
  44. id: 1,
  45. operator: '',
  46. value: '',
  47. text: 'BIG',
  48. type: 2,
  49. from: '50',
  50. to: '1000',
  51. },
  52. ],
  53. valueOptions: {
  54. decimals: 3,
  55. prefix: 'XX',
  56. stat: 'last',
  57. suffix: 'YY',
  58. unit: 'accMS2',
  59. },
  60. },
  61. pluginVersion: '6.1.6',
  62. targets: [
  63. {
  64. refId: 'A',
  65. },
  66. {
  67. refId: 'B',
  68. },
  69. {
  70. refId: 'C',
  71. },
  72. ],
  73. timeFrom: null,
  74. timeShift: null,
  75. title: 'Panel Title',
  76. type: 'gauge',
  77. } as PanelModel;
  78. expect(gaugePanelMigrationCheck(panel)).toMatchSnapshot();
  79. });
  80. });