inboxReason.spec.jsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import {mountWithTheme} from 'sentry-test/enzyme';
  2. import InboxReason from 'app/components/group/inboxBadges/inboxReason';
  3. describe('InboxReason', () => {
  4. let inbox;
  5. beforeEach(() => {
  6. inbox = {
  7. reason: 0,
  8. date_added: new Date(),
  9. reason_details: null,
  10. };
  11. });
  12. it('displays new issue inbox reason', () => {
  13. const wrapper = mountWithTheme(<InboxReason inbox={inbox} />);
  14. expect(wrapper.text()).toBe('New Issue');
  15. });
  16. it('displays time added to inbox', () => {
  17. const wrapper = mountWithTheme(<InboxReason showDateAdded inbox={inbox} />);
  18. expect(wrapper.find('TimeSince').exists()).toBeTruthy();
  19. });
  20. it('has a tooltip', () => {
  21. const wrapper = mountWithTheme(<InboxReason inbox={inbox} />);
  22. const tooltip = mountWithTheme(wrapper.find('Tooltip').prop('title'));
  23. expect(tooltip.text()).toContain('Mark Reviewed to remove this label');
  24. });
  25. it('has affected user count', () => {
  26. const wrapper = mountWithTheme(
  27. <InboxReason
  28. inbox={{
  29. ...inbox,
  30. reason: 1,
  31. reason_details: {
  32. count: null,
  33. until: null,
  34. user_count: 10,
  35. user_window: null,
  36. window: null,
  37. },
  38. }}
  39. />
  40. );
  41. const tooltip = mountWithTheme(wrapper.find('Tooltip').prop('title'));
  42. expect(tooltip.text()).toContain('Affected 10 user(s)');
  43. });
  44. });