-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c6101a2
commit aa3fa95
Showing
7 changed files
with
100 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import React from 'react'; | ||
import { | ||
render, | ||
fireEvent, | ||
|
@@ -18,6 +17,7 @@ import CourseTeam from './CourseTeam'; | |
import messages from './messages'; | ||
import { USER_ROLES } from '../constants'; | ||
import { executeThunk } from '../utils'; | ||
import { RequestStatus } from '../data/constants'; | ||
import { changeRoleTeamUserQuery, deleteCourseTeamQuery } from './data/thunk'; | ||
|
||
let axiosMock; | ||
|
@@ -219,4 +219,18 @@ describe('<CourseTeam />', () => { | |
await executeThunk(changeRoleTeamUserQuery(courseId, '[email protected]', { role: USER_ROLES.admin }), store.dispatch); | ||
expect(getAllByText('Admin')).toHaveLength(1); | ||
}); | ||
|
||
it('displays an alert and sets status to DENIED when API responds with 403', async () => { | ||
axiosMock | ||
.onGet(getCourseTeamApiUrl(courseId)) | ||
.reply(403); | ||
|
||
const { getByRole } = render(<RootWrapper />); | ||
|
||
await waitFor(() => { | ||
expect(getByRole('alert')).toBeInTheDocument(); | ||
const { loadingCourseTeamStatus } = store.getState().courseTeam; | ||
expect(loadingCourseTeamStatus).toEqual(RequestStatus.DENIED); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters