eventMetas.spec.tsx 1.4 KB

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