addMetricsDataMock.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export function addMetricsDataMock(settings?: {
  2. metricsCount: number;
  3. nullCount: number;
  4. unparamCount: number;
  5. compatibleProjects?: number[];
  6. dynamicSampledProjects?: number[];
  7. }) {
  8. const compatible_projects = settings?.compatibleProjects ?? [];
  9. const metricsCount = settings?.metricsCount ?? 10;
  10. const unparamCount = settings?.unparamCount ?? 0;
  11. const nullCount = settings?.nullCount ?? 0;
  12. const dynamic_sampling_projects = settings?.dynamicSampledProjects ?? [1];
  13. MockApiClient.addMockResponse({
  14. method: 'GET',
  15. url: `/organizations/org-slug/metrics-compatibility/`,
  16. body: {
  17. compatible_projects,
  18. dynamic_sampling_projects,
  19. },
  20. });
  21. MockApiClient.addMockResponse({
  22. method: 'GET',
  23. url: `/organizations/org-slug/metrics-compatibility-sums/`,
  24. body: {
  25. sum: {
  26. metrics: metricsCount,
  27. metrics_unparam: unparamCount,
  28. metrics_null: nullCount,
  29. },
  30. },
  31. });
  32. MockApiClient.addMockResponse({
  33. method: 'GET',
  34. url: `/organizations/org-slug/events/`,
  35. body: {
  36. data: [{}],
  37. meta: {},
  38. },
  39. });
  40. }