index.spec.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: '/organizations/org-slug/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. MockApiClient.addMockResponse({
  21. url: '/shared/issues/a/',
  22. body: TestStubs.Group({
  23. title: 'ZeroDivisionError',
  24. latestEvent: TestStubs.Event({
  25. entries: [eventEntry, exception],
  26. }),
  27. project: TestStubs.Project({organization: {slug: 'test-org'}}),
  28. }),
  29. });
  30. });
  31. afterEach(function () {
  32. MockApiClient.clearMockResponses();
  33. });
  34. it('renders', function () {
  35. render(
  36. <RouteContext.Provider value={{router, ...router}}>
  37. <SharedGroupDetails
  38. params={params}
  39. api={new MockApiClient()}
  40. route={{}}
  41. router={router}
  42. routes={router.routes}
  43. routeParams={router.params}
  44. location={router.location}
  45. />
  46. </RouteContext.Provider>
  47. );
  48. });
  49. it('renders with org slug in path', function () {
  50. const params_with_slug = {shareId: 'a', orgId: 'test-org'};
  51. const router_with_slug = TestStubs.router({params_with_slug});
  52. render(
  53. <RouteContext.Provider value={{router, ...router}}>
  54. <SharedGroupDetails
  55. params={params}
  56. api={new MockApiClient()}
  57. route={{}}
  58. router={router_with_slug}
  59. routes={router_with_slug.routes}
  60. routeParams={router_with_slug.params}
  61. location={router_with_slug.location}
  62. />
  63. </RouteContext.Provider>
  64. );
  65. });
  66. });