fix: unenroll messaging (#84)
This commit is contained in:
@@ -59,10 +59,7 @@ export const leaveEntitlementSession = (cardId) => (dispatch, getState) => {
|
||||
|
||||
export const unenrollFromCourse = (cardId) => (dispatch, getState) => {
|
||||
const { courseId } = selectors.app.courseCard.courseRun(getState(), cardId);
|
||||
dispatch(requests.unenrollFromCourse({
|
||||
courseId,
|
||||
onSuccess: () => dispatch(module.initialize()),
|
||||
}));
|
||||
dispatch(requests.unenrollFromCourse({ courseId }));
|
||||
};
|
||||
|
||||
export const masqueradeAs = (user) => (dispatch) => (
|
||||
|
||||
@@ -145,15 +145,10 @@ describe('app thunk actions', () => {
|
||||
});
|
||||
describe('unenrollFromCourse', () => {
|
||||
const reason = 'test-reason';
|
||||
beforeEach(() => {
|
||||
initializeSpy.mockImplementationOnce(mockInitialize);
|
||||
});
|
||||
it('dispatches unenrollFromCourse request action, re-initializing on success', () => {
|
||||
it('dispatches unenrollFromCourse request action', () => {
|
||||
module.unenrollFromCourse(cardId, reason)(dispatch, getState);
|
||||
const request = dispatch.mock.calls[0][0];
|
||||
expect(request.unenrollFromCourse.courseId).toEqual(courseId);
|
||||
request.unenrollFromCourse.onSuccess();
|
||||
expect(dispatch).toHaveBeenCalledWith(mockInitialize());
|
||||
});
|
||||
});
|
||||
describe('masqueradeAs', () => {
|
||||
|
||||
Reference in New Issue
Block a user