mutedBox.spec.jsx 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary';
  2. import MutedBox from 'sentry/components/mutedBox';
  3. describe('MutedBox', function () {
  4. describe('render()', function () {
  5. it('handles ignoreUntil', function () {
  6. const {container} = mountWithTheme(
  7. <MutedBox statusDetails={{ignoreUntil: '2017-06-21T19:45:10Z'}} />
  8. );
  9. expect(screen.getByText(/This issue has been ignored until/)).toBeInTheDocument();
  10. expect(container).toSnapshot();
  11. });
  12. it('handles ignoreCount', function () {
  13. const {container} = mountWithTheme(
  14. <MutedBox statusDetails={{ignoreUserCount: 100}} />
  15. );
  16. expect(
  17. screen.getByText(/This issue has been ignored until it affects/)
  18. ).toBeInTheDocument();
  19. expect(container).toSnapshot();
  20. });
  21. it('handles ignoreCount with ignoreWindow', function () {
  22. const {container} = mountWithTheme(
  23. <MutedBox statusDetails={{ignoreCount: 100, ignoreWindow: 1}} />
  24. );
  25. expect(
  26. screen.getByText(/This issue has been ignored until it occurs/)
  27. ).toBeInTheDocument();
  28. expect(container).toSnapshot();
  29. });
  30. it('handles ignoreUserCount', function () {
  31. const {container} = mountWithTheme(
  32. <MutedBox statusDetails={{ignoreUserCount: 100}} />
  33. );
  34. expect(
  35. screen.getByText(/This issue has been ignored until it affects/)
  36. ).toBeInTheDocument();
  37. expect(container).toSnapshot();
  38. });
  39. it('handles ignoreUserCount with ignoreUserWindow', function () {
  40. const {container} = mountWithTheme(
  41. <MutedBox statusDetails={{ignoreUserCount: 100, ignoreUserWindow: 1}} />
  42. );
  43. expect(
  44. screen.getByText(/This issue has been ignored until it affects/)
  45. ).toBeInTheDocument();
  46. expect(container).toSnapshot();
  47. });
  48. it('handles default', function () {
  49. const {container} = mountWithTheme(<MutedBox statusDetails={{}} />);
  50. expect(screen.getByText(/This issue has been ignored/)).toBeInTheDocument();
  51. expect(container).toSnapshot();
  52. });
  53. });
  54. });