charts.tsx 706 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const data = [
  2. [1543276800000, 0],
  3. [1543363200000, 0],
  4. [1543449600000, 36],
  5. [1543536000000, 40],
  6. [1543622400000, 0],
  7. [1543708800000, 17],
  8. [1543795200000, 104],
  9. [1543881600000, 13],
  10. ];
  11. const model = {
  12. _payload: {
  13. batch: [
  14. {
  15. startValue: 1543449600000,
  16. endValue: 1543708800000,
  17. },
  18. ],
  19. },
  20. series: [
  21. {
  22. data,
  23. },
  24. ],
  25. };
  26. export const chart = {
  27. getModel: jest.fn(() => ({...model})),
  28. };
  29. export const mockZoomRange = (startValue: number, endValue: number) => {
  30. chart.getModel.mockImplementation(() => ({
  31. ...model,
  32. _payload: {
  33. batch: [
  34. {
  35. startValue,
  36. endValue,
  37. },
  38. ],
  39. },
  40. }));
  41. };