import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary'; import InboxReason from 'sentry/components/group/inboxBadges/inboxReason'; describe('InboxReason', () => { let inbox; beforeEach(() => { inbox = { reason: 0, date_added: new Date(), reason_details: null, }; }); it('displays new issue inbox reason', () => { render(); expect(screen.getByText('New Issue')).toBeInTheDocument(); }); it('displays time added to inbox', () => { render(); // Use a pattern so we can work around slowness between beforeEach and here. expect(screen.getByText(/\d+(s|ms|m)/i)).toBeInTheDocument(); }); it('has a tooltip', async () => { render(); const tag = screen.getByText('New Issue'); userEvent.hover(tag); expect( await screen.findByText('Mark Reviewed to remove this label') ).toBeInTheDocument(); }); it('has affected user count', async () => { render( ); const tag = screen.getByText('Unignored'); userEvent.hover(tag); // Text is split up because of translations expect(await screen.findByText('Affected')).toBeInTheDocument(); expect(screen.getByText('10')).toBeInTheDocument(); expect(screen.getByText('user(s)')).toBeInTheDocument(); }); });