spendAllocation.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import type {SpendAllocation} from 'getsentry/views/spendAllocations/components/types';
  2. const now = new Date('2018-09-25'); // pin to subscription fixture start
  3. const future = new Date(now.getFullYear(), now.getMonth() + 1, now.getDate());
  4. const nowStr = now.toISOString();
  5. const futureStr = future.toISOString();
  6. const mockRootAllocations: SpendAllocation[] = [
  7. {
  8. id: 1,
  9. billingMetric: 'error', // NOTE: db billingMetrics are singular and lowercase
  10. consumedQuantity: 0,
  11. costPerItem: 1,
  12. period: [nowStr, futureStr],
  13. reservedQuantity: 100,
  14. targetId: 1,
  15. targetSlug: 'Orgfoo-errrs',
  16. targetType: 'Organization',
  17. shouldRecreate: true,
  18. },
  19. {
  20. id: 2,
  21. billingMetric: 'transaction',
  22. consumedQuantity: 0,
  23. costPerItem: 1,
  24. period: [nowStr, futureStr],
  25. reservedQuantity: 100,
  26. targetId: 2,
  27. targetSlug: 'Orgfoo-transactions',
  28. targetType: 'Organization',
  29. shouldRecreate: true,
  30. },
  31. {
  32. id: 3,
  33. billingMetric: 'attachment',
  34. consumedQuantity: 0,
  35. costPerItem: 1,
  36. period: [nowStr, futureStr],
  37. reservedQuantity: 100,
  38. targetId: 2,
  39. targetSlug: 'Orgfoo-attachments',
  40. targetType: 'Organization',
  41. shouldRecreate: true,
  42. },
  43. ];
  44. const mockProjectAllocations: SpendAllocation[] = [
  45. {
  46. id: 4,
  47. billingMetric: 'error',
  48. consumedQuantity: 0,
  49. costPerItem: 1,
  50. period: [nowStr, futureStr],
  51. reservedQuantity: 100,
  52. targetId: 1,
  53. targetSlug: 'Projfoo-E1',
  54. targetType: 'Project',
  55. shouldRecreate: true,
  56. },
  57. {
  58. id: 5,
  59. billingMetric: 'error',
  60. consumedQuantity: 0,
  61. costPerItem: 1,
  62. period: [nowStr, futureStr],
  63. reservedQuantity: 50,
  64. targetId: 2,
  65. targetSlug: 'Projfoo-E2',
  66. targetType: 'Project',
  67. shouldRecreate: true,
  68. },
  69. {
  70. id: 6,
  71. billingMetric: 'transaction',
  72. consumedQuantity: 0,
  73. costPerItem: 1,
  74. period: [nowStr, futureStr],
  75. reservedQuantity: 10,
  76. targetId: 3,
  77. targetSlug: 'Projfoo-transaction',
  78. targetType: 'Project',
  79. shouldRecreate: true,
  80. },
  81. ];
  82. const mockSpendAllocations = [...mockRootAllocations, ...mockProjectAllocations];
  83. export {mockSpendAllocations, mockRootAllocations};