eventMetas.spec.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import EventMetas from './eventMetas';
  3. describe('EventMetas', () => {
  4. it('Displays event created and received dates when hovering', async () => {
  5. const event = {
  6. ...TestStubs.Event(),
  7. dateReceived: '2017-05-21T18:01:48.762Z',
  8. dateCreated: '2017-05-21T18:02:48.762Z',
  9. };
  10. const routerContext = TestStubs.routerContext([]);
  11. const organization = TestStubs.Organization({});
  12. MockApiClient.addMockResponse({
  13. url: '/organizations/org-slug/projects/',
  14. body: [],
  15. });
  16. render(
  17. <EventMetas
  18. event={event}
  19. location={routerContext.context.location}
  20. organization={organization}
  21. errorDest="discover"
  22. transactionDest="discover"
  23. meta={null}
  24. projectId="1"
  25. quickTrace={null}
  26. />
  27. );
  28. await userEvent.hover(screen.getByText('5 months ago'));
  29. expect(await screen.findByText('Occurred')).toBeInTheDocument();
  30. expect(screen.getByText(/6:01:48 PM UTC/)).toBeInTheDocument();
  31. expect(screen.getByText('Received')).toBeInTheDocument();
  32. expect(screen.getByText(/6:02:48 PM UTC/)).toBeInTheDocument();
  33. });
  34. });