index.spec.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import {render} from 'sentry-test/reactTestingLibrary';
  2. import {RouteContext} from 'sentry/views/routeContext';
  3. import SharedGroupDetails from 'sentry/views/sharedGroupDetails';
  4. describe('SharedGroupDetails', function () {
  5. const eventEntry = TestStubs.EventEntry();
  6. const exception = TestStubs.EventStacktraceException().entries[0];
  7. const params = {shareId: 'a'};
  8. const router = TestStubs.router({params});
  9. beforeEach(function () {
  10. MockApiClient.addMockResponse({
  11. url: '/shared/issues/a/',
  12. body: TestStubs.Group({
  13. title: 'ZeroDivisionError',
  14. latestEvent: TestStubs.Event({
  15. entries: [eventEntry, exception],
  16. }),
  17. project: TestStubs.Project({organization: {slug: 'test-org'}}),
  18. }),
  19. });
  20. });
  21. afterEach(function () {
  22. MockApiClient.clearMockResponses();
  23. });
  24. it('renders', function () {
  25. const {container} = render(
  26. <RouteContext.Provider value={{router, ...router}}>
  27. <SharedGroupDetails
  28. params={params}
  29. api={new MockApiClient()}
  30. route={{}}
  31. router={router}
  32. routes={router.routes}
  33. routeParams={router.params}
  34. location={router.location}
  35. />
  36. </RouteContext.Provider>
  37. );
  38. expect(container).toSnapshot();
  39. });
  40. });