issues.spec.tsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import {GlobalSelectionFixture} from 'sentry-fixture/globalSelection';
  2. import {GroupFixture} from 'sentry-fixture/group';
  3. import {OrganizationFixture} from 'sentry-fixture/organization';
  4. import {ProjectFixture} from 'sentry-fixture/project';
  5. import {GroupStatus} from 'sentry/types/group';
  6. import {transformIssuesResponseToTable} from 'sentry/views/dashboards/datasetConfig/issues';
  7. describe('transformIssuesResponseToTable', function () {
  8. it('transforms issues response', () => {
  9. expect(
  10. transformIssuesResponseToTable(
  11. [
  12. GroupFixture({
  13. id: '1',
  14. title: 'Error: Failed',
  15. project: ProjectFixture({
  16. id: '3',
  17. }),
  18. status: GroupStatus.UNRESOLVED,
  19. owners: [
  20. {
  21. type: 'ownershipRule',
  22. owner: 'user:2',
  23. date_added: '2022-01-01T13:04:02Z',
  24. },
  25. ],
  26. lifetime: {count: '10', firstSeen: '', lastSeen: '', stats: {}, userCount: 5},
  27. count: '6',
  28. userCount: 3,
  29. firstSeen: '2022-01-01T13:04:02Z',
  30. }),
  31. ],
  32. {
  33. name: '',
  34. fields: ['issue', 'assignee', 'title', 'culprit', 'status'],
  35. columns: ['issue', 'assignee', 'title', 'culprit', 'status'],
  36. aggregates: [],
  37. conditions: 'assigned_or_suggested:#visibility timesSeen:>100',
  38. orderby: '',
  39. },
  40. OrganizationFixture(),
  41. GlobalSelectionFixture()
  42. )
  43. ).toEqual(
  44. expect.objectContaining({
  45. data: [
  46. expect.objectContaining({
  47. discoverSearchQuery: ' assigned_or_suggested:#visibility timesSeen:>100',
  48. events: '6',
  49. firstSeen: '2022-01-01T13:04:02Z',
  50. id: '1',
  51. 'issue.id': '1',
  52. lifetimeUsers: 5,
  53. links: '',
  54. period: '',
  55. projectId: '3',
  56. status: 'unresolved',
  57. title: 'Error: Failed',
  58. users: 3,
  59. end: '2019-09-09T11:18:59',
  60. start: '2019-10-09T11:18:59',
  61. }),
  62. ],
  63. })
  64. );
  65. });
  66. });