transformMetricsResponseToTable.spec.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import {transformMetricsResponseToTable} from 'sentry/utils/metrics/transformMetricsResponseToTable';
  2. describe('transformMetricsResponseToTable', function () {
  3. it('transforms metrics into table', () => {
  4. expect(
  5. transformMetricsResponseToTable(
  6. TestStubs.MetricsSessionUserCountByStatusByRelease()
  7. )
  8. ).toEqual({
  9. data: [
  10. {
  11. 'count_unique(sentry.sessions.user)': 1,
  12. id: '0',
  13. release: '1',
  14. 'session.status': 'crashed',
  15. 'sum(sentry.sessions.session)': 34,
  16. },
  17. {
  18. 'count_unique(sentry.sessions.user)': 1,
  19. id: '1',
  20. release: '1',
  21. 'session.status': 'abnormal',
  22. 'sum(sentry.sessions.session)': 1,
  23. },
  24. {
  25. 'count_unique(sentry.sessions.user)': 2,
  26. id: '2',
  27. release: '1',
  28. 'session.status': 'errored',
  29. 'sum(sentry.sessions.session)': 451,
  30. },
  31. {
  32. 'count_unique(sentry.sessions.user)': 3,
  33. id: '3',
  34. release: '1',
  35. 'session.status': 'healthy',
  36. 'sum(sentry.sessions.session)': 5058,
  37. },
  38. {
  39. 'count_unique(sentry.sessions.user)': 2,
  40. id: '4',
  41. release: '2',
  42. 'session.status': 'crashed',
  43. 'sum(sentry.sessions.session)': 35,
  44. },
  45. {
  46. 'count_unique(sentry.sessions.user)': 1,
  47. id: '5',
  48. release: '2',
  49. 'session.status': 'abnormal',
  50. 'sum(sentry.sessions.session)': 1,
  51. },
  52. {
  53. 'count_unique(sentry.sessions.user)': 1,
  54. id: '6',
  55. release: '2',
  56. 'session.status': 'errored',
  57. 'sum(sentry.sessions.session)': 452,
  58. },
  59. {
  60. 'count_unique(sentry.sessions.user)': 10,
  61. id: '7',
  62. release: '2',
  63. 'session.status': 'healthy',
  64. 'sum(sentry.sessions.session)': 5059,
  65. },
  66. ],
  67. meta: {
  68. 'count_unique(sentry.sessions.user)': 'integer',
  69. release: 'string',
  70. 'session.status': 'string',
  71. 'sum(sentry.sessions.session)': 'integer',
  72. },
  73. });
  74. });
  75. });