withOrganization.tsx 523 B

12345678910111213141516171819202122
  1. import {Component} from 'react';
  2. import SentryTypes from 'sentry/sentryTypes';
  3. declare const TestStubs;
  4. const withOrganizationMock = WrappedComponent =>
  5. class WithOrganizationMockWrapper extends Component {
  6. static contextTypes = {
  7. organization: SentryTypes.Organization,
  8. };
  9. render() {
  10. return (
  11. <WrappedComponent
  12. organization={this.context.organization || TestStubs.Organization()}
  13. {...this.props}
  14. />
  15. );
  16. }
  17. };
  18. export default withOrganizationMock;