utils.test.ts 580 B

123456789101112131415161718
  1. import { toDataFrame, FieldType } from '@grafana/data';
  2. import { getDataTimeRange } from './utils';
  3. describe('DataFrame utility functions', () => {
  4. const frame = toDataFrame({
  5. fields: [
  6. { name: 'fist', type: FieldType.time, values: [2, 3, 5] },
  7. { name: 'second', type: FieldType.time, values: [7, 8, 9] },
  8. { name: 'third', type: FieldType.number, values: [2000, 3000, 1000] },
  9. ],
  10. });
  11. it('Should find time range', () => {
  12. const range = getDataTimeRange([frame]);
  13. expect(range!.from).toEqual(2);
  14. expect(range!.to).toEqual(9);
  15. });
  16. });