Skip to content

Commit

Permalink
fix: set axios mock and update frontend-essentials dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Jun 16, 2023
1 parent ee209b3 commit e05ee9c
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 12 deletions.
210 changes: 199 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"url": "https://github.com/openedx/frontend-app-learning/issues"
},
"dependencies": {
"@edunext/frontend-essentials": "^1.1.0",
"@edunext/frontend-essentials": "^1.1.1",
"@edx/brand": "npm:@edx/[email protected]",
"@edx/frontend-component-footer": "11.6.3",
"@edx/frontend-component-header": "3.6.4",
Expand Down
4 changes: 4 additions & 0 deletions src/course-home/outline-tab/OutlineTab.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('Outline Tab', () => {
const masqueradeUrl = `${getConfig().LMS_BASE_URL}/courses/${courseId}/masquerade`;
const outlineUrl = `${getConfig().LMS_BASE_URL}/api/course_home/outline/${courseId}`;
const proctoringInfoUrl = `${getConfig().LMS_BASE_URL}/api/edx_proctoring/v1/user_onboarding/status?is_learning_mfe=true&course_id=${encodeURIComponent(courseId)}&username=MockUser`;
const progressUrl = `${getConfig().LMS_BASE_URL}/api/course_home/progress/${courseId}`;

const store = initializeStore();
const defaultMetadata = Factory.build('courseHomeMetadata');
Expand Down Expand Up @@ -76,6 +77,9 @@ describe('Outline Tab', () => {
onboarding_link: 'test',
expiration_date: null,
});
// This will return 404 in order to set the failure behavior and don't set extra
// extra conditions required by the success path.
axiosMock.onGet(progressUrl).reply(404, {});

logUnhandledRequests(axiosMock);
});
Expand Down
4 changes: 4 additions & 0 deletions src/product-tours/ProductTours.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('Course Home Tours', () => {
const outlineUrl = `${getConfig().LMS_BASE_URL}/api/course_home/outline/${courseId}`;
const tourDataUrl = `${getConfig().LMS_BASE_URL}/api/user_tours/v1/MockUser`;
const proctoringUrl = `${getConfig().LMS_BASE_URL}/api/edx_proctoring/v1/user_onboarding/status?is_learning_mfe=true&course_id=course-v1%3AedX%2BTest%2Brun&username=MockUser`;
const progressUrl = `${getConfig().LMS_BASE_URL}/api/course_home/progress/${courseId}`;

const store = initializeStore();
const defaultTabData = Factory.build('outlineTabData');
Expand Down Expand Up @@ -79,6 +80,9 @@ describe('Course Home Tours', () => {
course_home_tour_status: 'no-tour',
show_courseware_tour: false,
});
// This will return 404 in order to set the failure behavior and don't set extra
// extra conditions required by the success path.
axiosMock.onGet(progressUrl).reply(404, {});

logUnhandledRequests(axiosMock);
});
Expand Down

0 comments on commit e05ee9c

Please sign in to comment.