lk/resume button url (#56)

This commit is contained in:
leangseu-edx
2022-10-26 15:22:06 -04:00
committed by GitHub
parent 254ccfccb6
commit 41df13b059
12 changed files with 82 additions and 94 deletions

View File

@@ -42,9 +42,9 @@ export const useSelectSessionModalData = () => {
const handleSelection = ({ target: { value } }) => setSelectedSession(value);
const handleSubmit = () => {
if (selectedSession === LEAVE_OPTION) {
return dispatch(thunkActions.requests.leaveEntitlementSession({ uuid }));
return dispatch(thunkActions.app.leaveEntitlementSession({ uuid }));
}
return dispatch(thunkActions.requests.updateEntitlementEnrollment({ uuid, courseId: selectedSession }));
return dispatch(thunkActions.app.switchEntitlementEnrollment({ uuid, courseId: selectedSession }));
};
return {

View File

@@ -24,9 +24,9 @@ jest.mock('data/redux', () => ({
},
},
thunkActions: {
requests: {
updateEntitlementEnrollment: jest.fn((...args) => ({ updateEntitlementSession: args })),
leaveEntitlementSession: jest.fn((...args) => ({ leaveEntitlementSession: args })),
app: {
leaveEntitlementSession: jest.fn(),
switchEntitlementEnrollment: jest.fn(),
},
},
}));
@@ -111,14 +111,14 @@ describe('SelectSessionModal hooks', () => {
state.mockVal(state.keys.selectedSession, testValue);
runHook({});
expect(out.handleSubmit()).toEqual(dispatch(
thunkActions.requests.updateEntitlementEnrollment({ courseId: testValue, uuid }),
thunkActions.app.switchEntitlementEnrollment({ courseId: testValue, uuid }),
));
});
it('dispatches leaveEntitlementSession if LEAVE_OPTION is selected', () => {
state.mockVal(state.keys.selectedSession, LEAVE_OPTION);
runHook({});
expect(out.handleSubmit()).toEqual(dispatch(
thunkActions.requests.leaveEntitlementSession({ uuid }),
thunkActions.app.leaveEntitlementSession({ uuid }),
));
});
});