processingIssueHint.spec.jsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import ProcessingIssueHint from 'app/components/stream/processingIssueHint';
  3. describe('ProcessingIssueHint', function () {
  4. let issue, wrapper;
  5. const orgId = 'test-org';
  6. const projectId = 'test-project';
  7. beforeEach(() => {
  8. issue = {
  9. hasIssues: false,
  10. hasMoreResolveableIssues: false,
  11. issuesProcessing: 0,
  12. lastSeen: '2019-01-16T15:38:38Z',
  13. numIssues: 0,
  14. resolveableIssues: 0,
  15. signedLink: null,
  16. };
  17. });
  18. describe('numIssues state', function () {
  19. beforeEach(() => {
  20. issue.numIssues = 9;
  21. wrapper = mountWithTheme(
  22. <ProcessingIssueHint issue={issue} orgId={orgId} projectId={projectId} />
  23. );
  24. });
  25. it('displays a button', function () {
  26. const button = wrapper.find('Button');
  27. expect(button.length).toBe(1);
  28. expect(button.props().to).toEqual(
  29. `/settings/${orgId}/projects/${projectId}/processing-issues/`
  30. );
  31. });
  32. it('displays an icon', function () {
  33. const icon = wrapper.find('IconWarning');
  34. expect(icon.length).toBe(1);
  35. });
  36. it('displays text', function () {
  37. const text = wrapper.find('Wrapper').text();
  38. expect(text).toEqual(expect.stringContaining('issues blocking'));
  39. });
  40. });
  41. describe('issuesProcessing state', function () {
  42. beforeEach(() => {
  43. issue.issuesProcessing = 9;
  44. wrapper = mountWithTheme(
  45. <ProcessingIssueHint issue={issue} orgId={orgId} projectId={projectId} />
  46. );
  47. });
  48. it('does not display a button', function () {
  49. const button = wrapper.find('Button');
  50. expect(button.length).toBe(0);
  51. });
  52. it('displays an icon', function () {
  53. const icon = wrapper.find('IconSettings');
  54. expect(icon.length).toBe(1);
  55. });
  56. it('displays text', function () {
  57. const text = wrapper.find('Wrapper').text();
  58. expect(text).toEqual(expect.stringContaining('Reprocessing'));
  59. });
  60. });
  61. describe('resolvableIssues state', function () {
  62. beforeEach(() => {
  63. issue.resolveableIssues = 9;
  64. wrapper = mountWithTheme(
  65. <ProcessingIssueHint issue={issue} orgId={orgId} projectId={projectId} />
  66. );
  67. });
  68. it('displays a button', function () {
  69. const button = wrapper.find('Button');
  70. expect(button.length).toBe(1);
  71. expect(button.props().to).toEqual(
  72. `/settings/${orgId}/projects/${projectId}/processing-issues/`
  73. );
  74. });
  75. it('displays an icon', function () {
  76. const icon = wrapper.find('IconSettings');
  77. expect(icon.length).toBe(1);
  78. });
  79. it('displays text', function () {
  80. const text = wrapper.find('Wrapper').text();
  81. expect(text).toEqual(expect.stringContaining('pending reprocessing'));
  82. });
  83. });
  84. describe('showProject state', function () {
  85. beforeEach(() => {
  86. issue.numIssues = 9;
  87. wrapper = mountWithTheme(
  88. <ProcessingIssueHint
  89. showProject
  90. issue={issue}
  91. orgId={orgId}
  92. projectId={projectId}
  93. />
  94. );
  95. });
  96. it('displays the project slug', function () {
  97. const text = wrapper.find('Wrapper').text();
  98. expect(text).toEqual(expect.stringContaining(projectId));
  99. });
  100. });
  101. });