routerContextFixture.ts 696 B

12345678910111213141516171819202122
  1. import {LocationFixture} from 'sentry-fixture/locationFixture';
  2. import {ProjectFixture} from 'sentry-fixture/project';
  3. import {RouterFixture} from 'sentry-fixture/routerFixture';
  4. import {SentryPropTypeValidators} from 'sentry/sentryPropTypeValidators';
  5. export function RouterContextFixture([context, childContextTypes] = []) {
  6. return {
  7. context: {
  8. location: LocationFixture(),
  9. router: RouterFixture(),
  10. project: ProjectFixture(),
  11. ...context,
  12. },
  13. childContextTypes: {
  14. router: SentryPropTypeValidators.isObject,
  15. location: SentryPropTypeValidators.isObject,
  16. project: SentryPropTypeValidators.isObject,
  17. ...childContextTypes,
  18. },
  19. };
  20. }