routeComponentPropsFixture.tsx 560 B

123456789101112131415161718
  1. import type {RouteComponentProps} from 'react-router';
  2. import RouterFixture from 'sentry-fixture/routerFixture';
  3. export default function RouteComponentPropsFixture<
  4. RouteParams = {orgId: string; projectId: string},
  5. >(
  6. params: Partial<RouteComponentProps<RouteParams, {}>> = {}
  7. ): RouteComponentProps<RouteParams, {}> {
  8. const router = RouterFixture(params);
  9. return {
  10. location: router.location,
  11. params: router.params as RouteParams & {},
  12. routes: router.routes,
  13. route: router.routes[0],
  14. routeParams: router.params,
  15. router,
  16. };
  17. }