issues.spec.tsx 2.0 KB

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