eventMetas.spec.tsx 1.2 KB

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