billingHistory.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {MetricHistoryFixture} from 'getsentry-test/fixtures/metricHistory';
  2. import {PlanDetailsLookupFixture} from 'getsentry-test/fixtures/planDetailsLookup';
  3. import {DataCategory} from 'sentry/types/core';
  4. import type {BillingHistory as TBillingHistory} from 'getsentry/types';
  5. import {OnDemandBudgetMode} from 'getsentry/types';
  6. export function BillingHistoryFixture(
  7. params: Partial<TBillingHistory> = {}
  8. ): TBillingHistory {
  9. const planData = {plan: 'am1_f', ...params};
  10. const planDetails = PlanDetailsLookupFixture(planData.plan);
  11. return {
  12. id: '625529670',
  13. isCurrent: true,
  14. onDemandMaxSpend: 0,
  15. onDemandSpend: 0,
  16. onDemandBudgetMode: OnDemandBudgetMode.SHARED,
  17. plan: planDetails!.id,
  18. planName: planDetails!.name,
  19. planDetails: planDetails!,
  20. periodStart: '2018-01-01',
  21. periodEnd: '2018-01-31',
  22. categories: {
  23. errors: MetricHistoryFixture({
  24. category: DataCategory.ERRORS,
  25. reserved: 5_000,
  26. prepaid: 5_000,
  27. }),
  28. transactions: MetricHistoryFixture({
  29. category: DataCategory.TRANSACTIONS,
  30. reserved: 10_000,
  31. prepaid: 10_000,
  32. }),
  33. attachments: MetricHistoryFixture({
  34. category: DataCategory.ATTACHMENTS,
  35. reserved: 1,
  36. prepaid: 1,
  37. }),
  38. },
  39. links: {
  40. csv: 'https://sentry.io/organizations/acme/billing/history/625529670/export/',
  41. csvPerProject:
  42. 'https://sentry.io/organizations/acme/billing/history/625529670/export/per-project/',
  43. },
  44. usage: {
  45. errors: 0,
  46. transactions: 0,
  47. attachments: 0,
  48. },
  49. reserved: {
  50. errors: 5_000,
  51. transactions: 10_000,
  52. attachments: 1,
  53. },
  54. hasReservedBudgets: false,
  55. reservedBudgetCategories: [],
  56. hadCustomDynamicSampling: false,
  57. ...params,
  58. };
  59. }