import {render, screen} from 'sentry-test/reactTestingLibrary'; import TimeSince from 'sentry/components/timeSince'; describe('TimeSince', function () { const now = new Date(); const tenMinAgo = new Date(now.getTime() - 10 * 60 * 1000); it('renders a relative date', () => { const {rerender} = render(); expect(screen.getByText('a few seconds ago')).toBeInTheDocument(); rerender(); expect(screen.getByText('10 minutes ago')).toBeInTheDocument(); }); it('renders a relative date without suffix', () => { render(); expect(screen.getByText('10 minutes')).toBeInTheDocument(); }); it('renders a shortened date', () => { render(); expect(screen.getByText('10min ago')).toBeInTheDocument(); }); it('renders a extrashort date', () => { render(); expect(screen.getByText('10m ago')).toBeInTheDocument(); }); it('renders a spanish suffix', () => { render(); expect(screen.getByText('10 minutes atrás')).toBeInTheDocument(); }); it('renders a spanish suffix with shortened', () => { render(); expect(screen.getByText('10m atrás')).toBeInTheDocument(); }); });