-
Notifications
You must be signed in to change notification settings - Fork 295
feat: added support to check if active enterprise is same as EnterpriseCourseEnrollment object #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportBase: 83.97% // Head: 84.09% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #967 +/- ##
==========================================
+ Coverage 83.97% 84.09% +0.11%
==========================================
Files 260 264 +4
Lines 4475 4508 +33
Branches 1150 1155 +5
==========================================
+ Hits 3758 3791 +33
Misses 697 697
Partials 20 20
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
| {text} | ||
| <FormattedMessage | ||
| id="learning.activeEnterprise.alert" | ||
| description="Prompts the user to change active enterprise customer to access the course content." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prompts the user to log-in with the correct enterprise to access the course content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| <PageRoute | ||
| path={`${path}/home/:courseId`} | ||
| render={({ match }) => { | ||
| global.location.assign(`/course/${match.params.courseId}/home`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use Redirect or history.push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this whole file we are using the assign method, To make my code consistent with existing code I am using asign
muneebGH
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good hammad bhai 🎨
just a few comments.
| useDispatch: () => mockDispatch, | ||
| useSelector: () => ({ courseStatus: mockCourseStatus }), | ||
| })); | ||
| jest.mock('./PageLoading', () => () => <div data-testid="PageLoading" />); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we change data-testid to the format like page-loading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| history.push(accessDeniedUrl); | ||
| }); | ||
|
|
||
| it('Displays loading in start on page rendering', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async might not be needed here and in the 2 tests below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/index.jsx
Outdated
| <Switch> | ||
| <PageRoute exact path="/goal-unsubscribe/:token" component={GoalUnsubscribe} /> | ||
| <PageRoute path="/redirect" component={CoursewareRedirectLandingPage} /> | ||
| <PageRoute path="/course/:courseId/access_denied" component={CourseAccessErrorPage} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen the convention of using dashed instead of underscores in URLs many times, like should it be access-denied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| let mockData; | ||
| beforeAll(async () => { | ||
| await initializeTestStore({ excludeFetchCourse: true, excludeFetchSequence: true }); | ||
| mockData = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this assignment be moved out of beforeAll method to where declaration of variable is, as it will stay the same on every iteration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| expect(screen.getByRole('alert')).toBeInTheDocument(); | ||
| expect(screen.getByText('test message')).toBeInTheDocument(); | ||
| expect(screen.getByRole('link', { name: 'change enterprise now' })).toHaveAttribute( | ||
| 'href', 'http://localhost:18000/enterprise/select/active/?success_url=http%3A%2F%2Flocalhost%2F', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this base url needs to be dynamic like ${getConfig().LMS_BASE_URL}/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Idea, fixing.
| <Hyperlink | ||
| style={{ textDecoration: 'underline' }} | ||
| destination={ | ||
| `${getConfig().LMS_BASE_URL}/enterprise/select/active/?success_url=${encodeURIComponent(global.location.href)}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we please add /enterprise/select/active/ in constants, so that It can be written in one place and imported everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our project, We are not saving URL paths anywhere, I tried to follow code patterns here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I think we should follow this practice to call it everywhere from one place.
| @@ -0,0 +1,29 @@ | |||
| /* eslint-disable import/prefer-default-export */ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please remove this comment about disabling eslint. I think we don't need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must add this because we are not returning any default component from here.
…seCourseEnrollment object
28a232c to
d08b4f4
Compare
https://2u-internal.atlassian.net/browse/ENT-6111
If the active enterprise customer is not equal to the enrollment’s enterprise customer, return the incorrect_active_enterprise error from course-home:course-metadata API