SingleStatBaseOptions.test.ts 919 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { sharedSingleStatMigrationCheck } from './SingleStatBaseOptions';
  2. describe('sharedSingleStatMigrationCheck', () => {
  3. it('from old valueOptions model without pluginVersion', () => {
  4. const panel = {
  5. options: {
  6. valueOptions: {
  7. unit: 'watt',
  8. stat: 'last',
  9. decimals: 5,
  10. },
  11. minValue: 10,
  12. maxValue: 100,
  13. valueMappings: [{ type: 1, value: '1', text: 'OK' }],
  14. thresholds: [
  15. {
  16. color: 'green',
  17. index: 0,
  18. value: null,
  19. },
  20. {
  21. color: 'orange',
  22. index: 1,
  23. value: 40,
  24. },
  25. {
  26. color: 'red',
  27. index: 2,
  28. value: 80,
  29. },
  30. ],
  31. },
  32. title: 'Usage',
  33. type: 'bargauge',
  34. };
  35. expect(sharedSingleStatMigrationCheck(panel as any)).toMatchSnapshot();
  36. });
  37. });