helpers.ts 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { DefaultTimeZone, toUtc } from '@grafana/data';
  2. import { ExploreId } from '../../../types';
  3. export const createDefaultInitialState = () => {
  4. const t = toUtc();
  5. const testRange = {
  6. from: t,
  7. to: t,
  8. raw: {
  9. from: t,
  10. to: t,
  11. },
  12. };
  13. const defaultInitialState = {
  14. user: {
  15. orgId: '1',
  16. timeZone: DefaultTimeZone,
  17. },
  18. explore: {
  19. [ExploreId.left]: {
  20. datasourceInstance: {
  21. query: jest.fn(),
  22. getRef: jest.fn(),
  23. getLogsVolumeDataProvider: jest.fn(),
  24. meta: {
  25. id: 'something',
  26. },
  27. },
  28. initialized: true,
  29. containerWidth: 1920,
  30. eventBridge: { emit: () => {} } as any,
  31. queries: [{ expr: 'test' }] as any[],
  32. range: testRange,
  33. history: [],
  34. refreshInterval: {
  35. label: 'Off',
  36. value: 0,
  37. },
  38. cache: [],
  39. richHistory: [],
  40. },
  41. },
  42. };
  43. return { testRange, defaultInitialState };
  44. };