Skip to content

Commit

Permalink
chore: PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brobro10000 committed Dec 14, 2023
1 parent 3ceaecc commit da89e3f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
3 changes: 1 addition & 2 deletions src/components/course/routes/ExternalCourseEnrollment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ const ExternalCourseEnrollment = () => {
containerRef.current.scrollIntoView({ behavior: 'smooth' });
}
}, [externalCourseFormSubmissionError, containerRef]);

useEffect(() => {
// Once a redemption has successfully completed and the can-redeem query has been invalidated or
// a user attempts to navigate directly to :slug/executive-education-2u/course/:courseKey/enroll,
// it will run this conditional and perform the redirect
if (hasSuccessfulRedemption) {
history.push({ pathname: completeEnrollmentUrl });
history.push(completeEnrollmentUrl);
}
}, [completeEnrollmentUrl, course.key, hasSuccessfulRedemption, history, routeMatch.path, slug]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,9 @@ describe('ExternalCourseEnrollment', () => {
expect(screen.getByTestId('user-enrollment-form')).toBeInTheDocument();
expect(UserEnrollmentForm.mock.calls[0][0]).toEqual(
expect.objectContaining({
onCheckoutSuccess: expect.any(Function),
productSKU: 'test-sku',
}),
);
UserEnrollmentForm.mock.calls[0][0].onCheckoutSuccess();
expect(mockHistoryPush).toHaveBeenCalledTimes(1);
expect(mockHistoryPush).toHaveBeenCalledWith('enroll/complete');
});

it.each([
Expand Down

0 comments on commit da89e3f

Please sign in to comment.