routerContextFixture.tsx 859 B

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