import {render, screen} from 'sentry-test/reactTestingLibrary'; import ProjectActions from 'sentry/actions/projectActions'; import TeamActions from 'sentry/actions/teamActions'; import withTeamsForUser from 'sentry/utils/withTeamsForUser'; describe('withUserTeams HoC', function () { const api = new MockApiClient(); const organization = TestStubs.Organization(); delete organization.projects; function Output({error, teams}) { if (error) { return
Error: {error.responseText}
; } return ({teams.map(team => ( {team.slug} ))}
); } beforeEach(function () { MockApiClient.clearMockResponses(); jest.spyOn(ProjectActions, 'loadProjects'); jest.spyOn(TeamActions, 'loadTeams'); }); it('forwards errors', async function () { MockApiClient.addMockResponse({ url: `/organizations/${organization.slug}/user-teams/`, statusCode: 400, }); const Container = withTeamsForUser(Output); render(