diff --git a/package.json b/package.json index 853b42f36d..03936bdb85 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "i18n_extract": "fedx-scripts formatjs extract", "lint": "fedx-scripts eslint --ext .js --ext .jsx --ext .ts --ext .tsx .", "lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx .", - "snapshot": "fedx-scripts jest --updateSnapshot", "start": "fedx-scripts webpack-dev-server --progress", "start:with-theme": "paragon install-theme && npm start && npm install", "dev": "PUBLIC_PATH=/learning/ MFE_CONFIG_API_URL='http://localhost:8000/api/mfe_config/v1' fedx-scripts webpack-dev-server --progress --host apps.local.openedx.io", diff --git a/src/course-home/courseware-search/__snapshots__/map-search-response.test.js.snap b/src/course-home/courseware-search/__snapshots__/map-search-response.test.js.snap deleted file mode 100644 index 17fc65ad55..0000000000 --- a/src/course-home/courseware-search/__snapshots__/map-search-response.test.js.snap +++ /dev/null @@ -1,306 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`mapSearchResponse when the response is correct should match snapshot 1`] = ` -{ - "filters": [ - { - "count": 7, - "key": "capa", - "label": "CAPA", - }, - { - "count": 2, - "key": "sequence", - "label": "Sequence", - }, - { - "count": 9, - "key": "text", - "label": "Text", - }, - { - "count": 1, - "key": "unknown", - "label": "Unknown", - }, - { - "count": 2, - "key": "video", - "label": "Video", - }, - ], - "maxScore": 3.4545178, - "ms": 5, - "results": [ - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", - "location": [ - "Introduction", - "Demo Course Overview", - ], - "score": 3.4545178, - "title": "Demo Course Overview", - "type": "sequence", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@5e009378f0b64585baa0a14b155974b9", - "location": [ - "About Exams and Certificates", - "edX Exams", - "Passing a Course", - ], - "score": 3.4545178, - "title": "Passing a Course", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@5e009378f0b64585baa0a14b155974b9", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@vertical+block@c7e98fd39a6944edb6b286c32e1150ff", - "location": [ - "About Exams and Certificates", - "edX Exams", - "Passing a Course", - ], - "score": 3.4545178, - "title": "Passing a Course", - "type": "sequence", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@vertical+block@c7e98fd39a6944edb6b286c32e1150ff", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@0d759dee4f9d459c8956136dbde55f02", - "location": [ - "Example Week 1: Getting Started", - "Homework - Question Styles", - "Text input", - ], - "score": 1.5874016, - "title": "Text Input", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@0d759dee4f9d459c8956136dbde55f02", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@c554538a57664fac80783b99d9d6da7c", - "location": [ - "Example Week 1: Getting Started", - "Homework - Question Styles", - "Pointing on a Picture", - ], - "score": 1.5499392, - "title": "Pointing on a Picture", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@c554538a57664fac80783b99d9d6da7c", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@45d46192272c4f6db6b63586520bbdf4", - "location": [ - "About Exams and Certificates", - "edX Exams", - "Getting Answers", - ], - "score": 1.5003732, - "title": "Getting Answers", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@45d46192272c4f6db6b63586520bbdf4", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@video+block@0b9e39477cf34507a7a48f74be381fdd", - "location": [ - "Introduction", - "Demo Course Overview", - "Introduction: Video and Sequences", - ], - "score": 1.4792063, - "title": "Welcome!", - "type": "video", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@video+block@0b9e39477cf34507a7a48f74be381fdd", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4", - "location": [ - "Example Week 1: Getting Started", - "Homework - Question Styles", - "Multiple Choice Questions", - ], - "score": 1.4341705, - "title": "Multiple Choice Questions", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@75f9562c77bc4858b61f907bb810d974", - "location": [ - "Example Week 1: Getting Started", - "Homework - Question Styles", - "Numerical Input", - ], - "score": 1.2987298, - "title": "Numerical Input", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@75f9562c77bc4858b61f907bb810d974", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@video+block@636541acbae448d98ab484b028c9a7f6", - "location": [ - "Example Week 1: Getting Started", - "Lesson 1 - Getting Started", - "Video Presentation Styles", - ], - "score": 1.1870136, - "title": "Connecting a Circuit and a Circuit Diagram", - "type": "video", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@video+block@636541acbae448d98ab484b028c9a7f6", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@python_grader", - "location": [ - "Example Week 2: Get Interactive", - "Homework - Labs and Demos", - "Code Grader", - ], - "score": 1.0107487, - "title": "CAPA", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@python_grader", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@problem+block@9cee77a606ea4c1aa5440e0ea5d0f618", - "location": [ - "Example Week 1: Getting Started", - "Lesson 1 - Getting Started", - "Interactive Questions", - ], - "score": 0.96387196, - "title": "Interactive Questions", - "type": "capa", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@problem+block@9cee77a606ea4c1aa5440e0ea5d0f618", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4", - "location": [ - "Introduction", - "Demo Course Overview", - "Introduction: Video and Sequences", - ], - "score": 0.8844358, - "title": "Blank HTML Page", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@html_49b4494da2f7", - "location": [ - "Example Week 3: Be Social", - "Lesson 3 - Be Social", - "Discussion Forums", - ], - "score": 0.8803684, - "title": "Discussion Forums", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@html_49b4494da2f7", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@f4a39219742149f781a1dda6f43a623c", - "location": [ - "About Exams and Certificates", - "edX Exams", - "Overall Grade Performance", - ], - "score": 0.87981963, - "title": "Overall Grade", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@f4a39219742149f781a1dda6f43a623c", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@87fa6792d79f4862be098e5169e93339", - "location": [ - "Example Week 3: Be Social", - "Lesson 3 - Be Social", - "Homework - Find Your Study Buddy", - ], - "score": 0.84284115, - "title": "Blank HTML Page", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@87fa6792d79f4862be098e5169e93339", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@6018785795994726950614ce7d0f38c5", - "location": [ - "Example Week 3: Be Social", - "Homework - Find Your Study Buddy", - "Homework - Find Your Study Buddy", - ], - "score": 0.84284115, - "title": "Find Your Study Buddy", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@6018785795994726950614ce7d0f38c5", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@f9f3a25e7bab46e583fd1fbbd7a2f6a0", - "location": [ - "Example Week 3: Be Social", - "Lesson 3 - Be Social", - "Be Social", - ], - "score": 0.84210813, - "title": "Be Social", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@f9f3a25e7bab46e583fd1fbbd7a2f6a0", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@8293139743f34377817d537b69911530", - "location": [ - "About Exams and Certificates", - "edX Exams", - "EdX Exams", - ], - "score": 0.8306555, - "title": "EdX Exams", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@8293139743f34377817d537b69911530", - }, - { - "contentHits": 0, - "id": "block-v1:edX+DemoX+Demo_Course+type@html+block@9d5104b502f24ee89c3d2f4ce9d347cf", - "location": [ - "Example Week 1: Getting Started", - "Lesson 1 - Getting Started", - "When Are Your Exams? ", - ], - "score": 0.82610154, - "title": "When Are Your Exams? ", - "type": "text", - "url": "/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@html+block@9d5104b502f24ee89c3d2f4ce9d347cf", - }, - { - "contentHits": 0, - "id": "random-element-id", - "location": null, - "score": 0.82610154, - "title": "External Course Link Test", - "type": "unknown", - "url": "https://www.edx.org", - }, - ], - "total": 29, -} -`; diff --git a/src/course-home/courseware-search/map-search-response.test.js b/src/course-home/courseware-search/map-search-response.test.js index 2ad4318a9c..76ae029efe 100644 --- a/src/course-home/courseware-search/map-search-response.test.js +++ b/src/course-home/courseware-search/map-search-response.test.js @@ -10,8 +10,8 @@ describe('mapSearchResponse', () => { response = mapSearchResponse(camelCaseObject(mockedResponse)); }); - it('should match snapshot', () => { - expect(response).toMatchSnapshot(); + it('should match number of results', () => { + expect(response.results.length).toBe(mockedResponse.results.length); }); it('should match expected filters', () => { diff --git a/src/course-home/data/__snapshots__/redux.test.js.snap b/src/course-home/data/__snapshots__/redux.test.js.snap deleted file mode 100644 index 1ccdd87ca4..0000000000 --- a/src/course-home/data/__snapshots__/redux.test.js.snap +++ /dev/null @@ -1,941 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Data layer integration tests Test fetchDatesTab Should fetch, normalize, and save metadata 1`] = ` -{ - "courseHome": { - "courseId": "course-v1:edX+DemoX+Demo_Course", - "courseStatus": "loaded", - "proctoringPanelStatus": "loading", - "showSearch": false, - "targetUserId": undefined, - "toastBodyLink": null, - "toastBodyText": null, - "toastHeader": "", - }, - "courseware": { - "courseId": null, - "courseOutline": {}, - "courseOutlineShouldUpdate": false, - "courseOutlineStatus": "loading", - "courseStatus": "loading", - "coursewareOutlineSidebarSettings": {}, - "sequenceId": null, - "sequenceMightBeUnit": false, - "sequenceStatus": "loading", - }, - "learningAssistant": ObjectContaining { - "conversationId": Any, - }, - "models": { - "courseHomeMeta": { - "course-v1:edX+DemoX+Demo_Course": { - "canViewCertificate": true, - "celebrations": null, - "courseAccess": { - "additionalContextUserMessage": null, - "developerMessage": null, - "errorCode": null, - "hasAccess": true, - "userFragment": null, - "userMessage": null, - }, - "id": "course-v1:edX+DemoX+Demo_Course", - "isEnrolled": false, - "isMasquerading": false, - "isNewDiscussionSidebarViewEnabled": false, - "isSelfPaced": false, - "isStaff": false, - "number": "DemoX", - "org": "edX", - "originalUserIsStaff": false, - "start": "2013-02-05T05:00:00Z", - "tabs": [ - { - "slug": "outline", - "title": "Course", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/course/", - }, - { - "slug": "discussion", - "title": "Discussion", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/discussion/forum/", - }, - { - "slug": "wiki", - "title": "Wiki", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/course_wiki", - }, - { - "slug": "progress", - "title": "Progress", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/progress", - }, - { - "slug": "instructor", - "title": "Instructor", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/instructor", - }, - { - "slug": "dates", - "title": "Dates", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/dates", - }, - ], - "title": "Demonstration Course", - "userTimezone": "UTC", - "username": "MockUser", - "verifiedMode": { - "accessExpirationDate": null, - "currency": "USD", - "currencySymbol": "$", - "price": 149, - "sku": "8CF08E5", - "upgradeUrl": "http://localhost:18130/basket/add/?sku=8CF08E5", - }, - }, - }, - "dates": { - "course-v1:edX+DemoX+Demo_Course": { - "courseDateBlocks": [ - { - "date": "2020-05-01T17:59:41Z", - "dateType": "course-start-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "", - "title": "Course Starts", - }, - { - "assignmentType": "Homework", - "complete": true, - "date": "2020-05-04T02:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "title": "Multi Badges Completed", - }, - { - "assignmentType": "Homework", - "date": "2020-05-05T02:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "title": "Multi Badges Past Due", - }, - { - "assignmentType": "Homework", - "date": "2020-05-27T02:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "Both Past Due 1", - }, - { - "assignmentType": "Homework", - "date": "2020-05-27T02:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "Both Past Due 2", - }, - { - "assignmentType": "Homework", - "complete": true, - "date": "2020-05-28T08:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "One Completed/Due 1", - }, - { - "assignmentType": "Homework", - "date": "2020-05-28T08:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "One Completed/Due 2", - }, - { - "assignmentType": "Homework", - "complete": true, - "date": "2020-05-29T08:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "Both Completed 1", - }, - { - "assignmentType": "Homework", - "complete": true, - "date": "2020-05-29T08:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "Both Completed 2", - }, - { - "date": "2020-06-16T17:59:40.942669Z", - "dateType": "verified-upgrade-deadline", - "description": "Don't miss the opportunity to highlight your new knowledge and skills by earning a verified certificate.", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "Upgrade to Verified Certificate", - }, - { - "assignmentType": "Homework", - "date": "2030-08-17T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": false, - "link": "https://example.com/", - "title": "One Verified 1", - }, - { - "assignmentType": "Homework", - "date": "2030-08-17T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "One Verified 2", - }, - { - "assignmentType": "Homework", - "date": "2030-08-17T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": "ORA Dates are set by the instructor, and can't be changed", - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "ORA Verified 2", - }, - { - "assignmentType": "Homework", - "date": "2030-08-18T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": false, - "link": "https://example.com/", - "title": "Both Verified 1", - }, - { - "assignmentType": "Homework", - "date": "2030-08-18T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": false, - "link": "https://example.com/", - "title": "Both Verified 2", - }, - { - "assignmentType": "Homework", - "date": "2030-08-19T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "learnerHasAccess": true, - "title": "One Unreleased 1", - }, - { - "assignmentType": "Homework", - "date": "2030-08-19T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "https://example.com/", - "title": "One Unreleased 2", - }, - { - "assignmentType": "Homework", - "date": "2030-08-20T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "title": "Both Unreleased 1", - }, - { - "assignmentType": "Homework", - "date": "2030-08-20T05:59:40.942669Z", - "dateType": "assignment-due-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "title": "Both Unreleased 2", - }, - { - "date": "2030-08-23T00:00:00Z", - "dateType": "course-end-date", - "description": "", - "extraInfo": null, - "learnerHasAccess": true, - "link": "", - "title": "Course Ends", - }, - { - "date": "2030-09-01T00:00:00Z", - "dateType": "verification-deadline-date", - "description": "You must successfully complete verification before this date to qualify for a Verified Certificate.", - "extraInfo": null, - "learnerHasAccess": false, - "link": "https://example.com/", - "title": "Verification Deadline", - }, - ], - "datesBannerInfo": { - "contentTypeGatingEnabled": false, - "missedDeadlines": false, - "missedGatedContent": false, - "verifiedUpgradeLink": "http://localhost:18130/basket/add/?sku=8CF08E5", - }, - "hasEnded": false, - "id": "course-v1:edX+DemoX+Demo_Course", - "learnerIsFullAccess": true, - }, - }, - }, - "plugins": {}, - "recommendations": { - "recommendationsStatus": "loading", - }, - "specialExams": { - "activeAttempt": null, - "allowProctoringOptOut": false, - "apiErrorMsg": "", - "exam": { - "attempt": { - "attempt_code": "", - "attempt_id": null, - "attempt_status": "", - "course_id": "", - "desktop_application_js_url": "", - "exam_display_name": "", - "exam_started_poll_url": "", - "exam_type": "", - "exam_url_path": "", - "external_id": "", - "in_timed_exam": true, - "ping_interval": null, - "taking_as_proctored": true, - "time_remaining_seconds": null, - "use_legacy_attempt_api": true, - }, - "backend": "", - "content_id": "", - "course_id": "", - "due_date": null, - "exam_name": "", - "external_id": "", - "hide_after_due": false, - "id": null, - "is_active": true, - "is_practice_exam": false, - "is_proctored": false, - "prerequisite_status": { - "are_prerequisites_satisifed": true, - "declined_prerequisites": [], - "failed_prerequisites": [], - "pending_prerequisites": [], - "satisfied_prerequisites": [], - }, - "time_limit_mins": null, - "type": "", - }, - "examAccessToken": { - "exam_access_token": "", - "exam_access_token_expiration": "", - }, - "isLoading": true, - "proctoringSettings": { - "exam_proctoring_backend": { - "download_url": "", - "instructions": [], - "name": "", - "rules": {}, - }, - "integration_specific_email": "", - "learner_notification_from_email": "", - "provider_name": "", - "provider_tech_support_email": "", - "provider_tech_support_phone": "", - "provider_tech_support_url": "", - }, - "timeIsOver": false, - }, - "tours": { - "showCoursewareTour": false, - "showExistingUserCourseHomeTour": false, - "showNewUserCourseHomeModal": false, - "showNewUserCourseHomeTour": false, - "toursEnabled": false, - }, -} -`; - -exports[`Data layer integration tests Test fetchOutlineTab Should fetch, normalize, and save metadata 1`] = ` -{ - "courseHome": { - "courseId": "course-v1:edX+DemoX+Demo_Course", - "courseStatus": "loaded", - "proctoringPanelStatus": "loading", - "showSearch": false, - "targetUserId": undefined, - "toastBodyLink": null, - "toastBodyText": null, - "toastHeader": "", - }, - "courseware": { - "courseId": null, - "courseOutline": {}, - "courseOutlineShouldUpdate": false, - "courseOutlineStatus": "loading", - "courseStatus": "loading", - "coursewareOutlineSidebarSettings": {}, - "sequenceId": null, - "sequenceMightBeUnit": false, - "sequenceStatus": "loading", - }, - "learningAssistant": ObjectContaining { - "conversationId": Any, - }, - "models": { - "courseHomeMeta": { - "course-v1:edX+DemoX+Demo_Course": { - "canViewCertificate": true, - "celebrations": null, - "courseAccess": { - "additionalContextUserMessage": null, - "developerMessage": null, - "errorCode": null, - "hasAccess": true, - "userFragment": null, - "userMessage": null, - }, - "id": "course-v1:edX+DemoX+Demo_Course", - "isEnrolled": false, - "isMasquerading": false, - "isNewDiscussionSidebarViewEnabled": false, - "isSelfPaced": false, - "isStaff": false, - "number": "DemoX", - "org": "edX", - "originalUserIsStaff": false, - "start": "2013-02-05T05:00:00Z", - "tabs": [ - { - "slug": "outline", - "title": "Course", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/course/", - }, - { - "slug": "discussion", - "title": "Discussion", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/discussion/forum/", - }, - { - "slug": "wiki", - "title": "Wiki", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/course_wiki", - }, - { - "slug": "progress", - "title": "Progress", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/progress", - }, - { - "slug": "instructor", - "title": "Instructor", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/instructor", - }, - { - "slug": "dates", - "title": "Dates", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/dates", - }, - ], - "title": "Demonstration Course", - "userTimezone": "UTC", - "username": "MockUser", - "verifiedMode": { - "accessExpirationDate": null, - "currency": "USD", - "currencySymbol": "$", - "price": 149, - "sku": "8CF08E5", - "upgradeUrl": "http://localhost:18130/basket/add/?sku=8CF08E5", - }, - }, - }, - "outline": { - "course-v1:edX+DemoX+Demo_Course": { - "accessExpiration": null, - "certData": { - "certStatus": null, - "certWebViewUrl": null, - "certificateAvailableDate": null, - }, - "courseBlocks": { - "courses": { - "block-v1:edX+DemoX+Demo_Course+type@course+block@bcdabcdabcdabcdabcdabcdabcdabcd3": { - "hasScheduledContent": false, - "id": "course-v1:edX+DemoX+Demo_Course", - "sectionIds": [ - "block-v1:edX+DemoX+Demo_Course+type@chapter+block@bcdabcdabcdabcdabcdabcdabcdabcd2", - ], - "title": "bcdabcdabcdabcdabcdabcdabcdabcd3", - }, - }, - "sections": { - "block-v1:edX+DemoX+Demo_Course+type@chapter+block@bcdabcdabcdabcdabcdabcdabcdabcd2": { - "complete": false, - "courseId": "course-v1:edX+DemoX+Demo_Course", - "hideFromTOC": undefined, - "id": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@bcdabcdabcdabcdabcdabcdabcdabcd2", - "resumeBlock": false, - "sequenceIds": [ - "block-v1:edX+DemoX+Demo_Course+type@sequential+block@bcdabcdabcdabcdabcdabcdabcdabcd1", - ], - "title": "Title of Section", - }, - }, - "sequences": { - "block-v1:edX+DemoX+Demo_Course+type@sequential+block@bcdabcdabcdabcdabcdabcdabcdabcd1": { - "complete": false, - "description": null, - "due": null, - "effortActivities": 2, - "effortTime": 15, - "hideFromTOC": undefined, - "icon": null, - "id": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@bcdabcdabcdabcdabcdabcdabcdabcd1", - "navigationDisabled": undefined, - "sectionId": "block-v1:edX+DemoX+Demo_Course+type@chapter+block@bcdabcdabcdabcdabcdabcdabcdabcd2", - "showLink": true, - "title": "Title of Sequence", - }, - }, - }, - "courseGoals": { - "daysPerWeek": null, - "goalOptions": [], - "selectedGoal": null, - "subscribedToReminders": null, - "weeklyLearningGoalEnabled": false, - }, - "courseTools": [ - { - "analyticsId": "edx.bookmarks", - "title": "Bookmarks", - "url": "https://example.com/bookmarks", - }, - ], - "datesBannerInfo": { - "contentTypeGatingEnabled": false, - "missedDeadlines": false, - "missedGatedContent": false, - }, - "datesWidget": { - "courseDateBlocks": [], - }, - "enableProctoredExams": undefined, - "enrollAlert": { - "canEnroll": true, - "extraText": "Contact the administrator.", - }, - "enrollmentMode": undefined, - "handoutsHtml": "", - "hasEnded": undefined, - "hasScheduledContent": null, - "id": "course-v1:edX+DemoX+Demo_Course", - "offer": null, - "resumeCourse": { - "hasVisitedCourse": false, - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+Test+Block@12345abcde", - }, - "timeOffsetMillis": 0, - "userHasPassingGrade": undefined, - "verifiedMode": { - "accessExpirationDate": "2050-01-01T12:00:00", - "currency": "USD", - "currencySymbol": "$", - "price": 149, - "sku": "ABCD1234", - "upgradeUrl": "http://localhost:18000/dashboard", - }, - "welcomeMessageHtml": "

Welcome to this course!

", - }, - }, - }, - "plugins": {}, - "recommendations": { - "recommendationsStatus": "loading", - }, - "specialExams": { - "activeAttempt": null, - "allowProctoringOptOut": false, - "apiErrorMsg": "", - "exam": { - "attempt": { - "attempt_code": "", - "attempt_id": null, - "attempt_status": "", - "course_id": "", - "desktop_application_js_url": "", - "exam_display_name": "", - "exam_started_poll_url": "", - "exam_type": "", - "exam_url_path": "", - "external_id": "", - "in_timed_exam": true, - "ping_interval": null, - "taking_as_proctored": true, - "time_remaining_seconds": null, - "use_legacy_attempt_api": true, - }, - "backend": "", - "content_id": "", - "course_id": "", - "due_date": null, - "exam_name": "", - "external_id": "", - "hide_after_due": false, - "id": null, - "is_active": true, - "is_practice_exam": false, - "is_proctored": false, - "prerequisite_status": { - "are_prerequisites_satisifed": true, - "declined_prerequisites": [], - "failed_prerequisites": [], - "pending_prerequisites": [], - "satisfied_prerequisites": [], - }, - "time_limit_mins": null, - "type": "", - }, - "examAccessToken": { - "exam_access_token": "", - "exam_access_token_expiration": "", - }, - "isLoading": true, - "proctoringSettings": { - "exam_proctoring_backend": { - "download_url": "", - "instructions": [], - "name": "", - "rules": {}, - }, - "integration_specific_email": "", - "learner_notification_from_email": "", - "provider_name": "", - "provider_tech_support_email": "", - "provider_tech_support_phone": "", - "provider_tech_support_url": "", - }, - "timeIsOver": false, - }, - "tours": { - "showCoursewareTour": false, - "showExistingUserCourseHomeTour": false, - "showNewUserCourseHomeModal": false, - "showNewUserCourseHomeTour": false, - "toursEnabled": false, - }, -} -`; - -exports[`Data layer integration tests Test fetchProgressTab Should fetch, normalize, and save metadata 1`] = ` -{ - "courseHome": { - "courseId": "course-v1:edX+DemoX+Demo_Course", - "courseStatus": "loaded", - "proctoringPanelStatus": "loading", - "showSearch": false, - "targetUserId": undefined, - "toastBodyLink": null, - "toastBodyText": null, - "toastHeader": "", - }, - "courseware": { - "courseId": null, - "courseOutline": {}, - "courseOutlineShouldUpdate": false, - "courseOutlineStatus": "loading", - "courseStatus": "loading", - "coursewareOutlineSidebarSettings": {}, - "sequenceId": null, - "sequenceMightBeUnit": false, - "sequenceStatus": "loading", - }, - "learningAssistant": ObjectContaining { - "conversationId": Any, - }, - "models": { - "courseHomeMeta": { - "course-v1:edX+DemoX+Demo_Course": { - "canViewCertificate": true, - "celebrations": null, - "courseAccess": { - "additionalContextUserMessage": null, - "developerMessage": null, - "errorCode": null, - "hasAccess": true, - "userFragment": null, - "userMessage": null, - }, - "id": "course-v1:edX+DemoX+Demo_Course", - "isEnrolled": false, - "isMasquerading": false, - "isNewDiscussionSidebarViewEnabled": false, - "isSelfPaced": false, - "isStaff": false, - "number": "DemoX", - "org": "edX", - "originalUserIsStaff": false, - "start": "2013-02-05T05:00:00Z", - "tabs": [ - { - "slug": "outline", - "title": "Course", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/course/", - }, - { - "slug": "discussion", - "title": "Discussion", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/discussion/forum/", - }, - { - "slug": "wiki", - "title": "Wiki", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/course_wiki", - }, - { - "slug": "progress", - "title": "Progress", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/progress", - }, - { - "slug": "instructor", - "title": "Instructor", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/instructor", - }, - { - "slug": "dates", - "title": "Dates", - "url": "http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/dates", - }, - ], - "title": "Demonstration Course", - "userTimezone": "UTC", - "username": "MockUser", - "verifiedMode": { - "accessExpirationDate": null, - "currency": "USD", - "currencySymbol": "$", - "price": 149, - "sku": "8CF08E5", - "upgradeUrl": "http://localhost:18130/basket/add/?sku=8CF08E5", - }, - }, - }, - "progress": { - "course-v1:edX+DemoX+Demo_Course": { - "accessExpiration": null, - "certificateData": {}, - "completionSummary": { - "completeCount": 1, - "incompleteCount": 1, - "lockedCount": 0, - }, - "courseGrade": { - "isPassing": true, - "letterGrade": "pass", - "percent": 1, - }, - "courseId": "course-v1:edX+DemoX+Demo_Course", - "creditCourseRequirements": null, - "end": "3027-03-31T00:00:00Z", - "enrollmentMode": "audit", - "gradesFeatureIsFullyLocked": false, - "gradesFeatureIsPartiallyLocked": false, - "gradingPolicy": { - "assignmentPolicies": [ - { - "averageGrade": "1.0000", - "numDroppable": 1, - "shortLabel": "HW", - "type": "Homework", - "weight": 1, - "weightedGrade": 1, - }, - ], - "gradeRange": { - "pass": 0.75, - }, - }, - "hasScheduledContent": false, - "id": "course-v1:edX+DemoX+Demo_Course", - "sectionScores": [ - { - "displayName": "First section", - "subsections": [ - { - "assignmentType": "Homework", - "blockKey": "block-v1:edX+DemoX+Demo_Course+type@sequential+block@12345", - "displayName": "First subsection", - "hasGradedAssignment": true, - "learnerHasAccess": true, - "numPointsEarned": 0, - "numPointsPossible": 3, - "percentGraded": 0, - "problemScores": [ - { - "earned": 0, - "possible": 1, - }, - { - "earned": 0, - "possible": 1, - }, - { - "earned": 0, - "possible": 1, - }, - ], - "showCorrectness": "always", - "showGrades": true, - "url": "http://learning.edx.org/course/course-v1:edX+Test+run/first_subsection", - }, - ], - }, - { - "displayName": "Second section", - "subsections": [ - { - "assignmentType": "Homework", - "displayName": "Second subsection", - "hasGradedAssignment": true, - "numPointsEarned": 1, - "numPointsPossible": 1, - "percentGraded": 1, - "problemScores": [ - { - "earned": 1, - "possible": 1, - }, - ], - "showCorrectness": "always", - "showGrades": true, - "url": "http://learning.edx.org/course/course-v1:edX+Test+run/second_subsection", - }, - ], - }, - ], - "studioUrl": "http://studio.edx.org/settings/grading/course-v1:edX+Test+run", - "userHasPassingGrade": false, - "verificationData": { - "link": null, - "status": "none", - "statusDate": null, - }, - "verifiedMode": null, - }, - }, - }, - "plugins": {}, - "recommendations": { - "recommendationsStatus": "loading", - }, - "specialExams": { - "activeAttempt": null, - "allowProctoringOptOut": false, - "apiErrorMsg": "", - "exam": { - "attempt": { - "attempt_code": "", - "attempt_id": null, - "attempt_status": "", - "course_id": "", - "desktop_application_js_url": "", - "exam_display_name": "", - "exam_started_poll_url": "", - "exam_type": "", - "exam_url_path": "", - "external_id": "", - "in_timed_exam": true, - "ping_interval": null, - "taking_as_proctored": true, - "time_remaining_seconds": null, - "use_legacy_attempt_api": true, - }, - "backend": "", - "content_id": "", - "course_id": "", - "due_date": null, - "exam_name": "", - "external_id": "", - "hide_after_due": false, - "id": null, - "is_active": true, - "is_practice_exam": false, - "is_proctored": false, - "prerequisite_status": { - "are_prerequisites_satisifed": true, - "declined_prerequisites": [], - "failed_prerequisites": [], - "pending_prerequisites": [], - "satisfied_prerequisites": [], - }, - "time_limit_mins": null, - "type": "", - }, - "examAccessToken": { - "exam_access_token": "", - "exam_access_token_expiration": "", - }, - "isLoading": true, - "proctoringSettings": { - "exam_proctoring_backend": { - "download_url": "", - "instructions": [], - "name": "", - "rules": {}, - }, - "integration_specific_email": "", - "learner_notification_from_email": "", - "provider_name": "", - "provider_tech_support_email": "", - "provider_tech_support_phone": "", - "provider_tech_support_url": "", - }, - "timeIsOver": false, - }, - "tours": { - "showCoursewareTour": false, - "showExistingUserCourseHomeTour": false, - "showNewUserCourseHomeModal": false, - "showNewUserCourseHomeTour": false, - "toursEnabled": false, - }, -} -`; diff --git a/src/course-home/data/redux.test.js b/src/course-home/data/redux.test.js index b46433927a..2054f5e3c2 100644 --- a/src/course-home/data/redux.test.js +++ b/src/course-home/data/redux.test.js @@ -90,14 +90,14 @@ describe('Data layer integration tests', () => { const state = store.getState(); expect(state.courseHome.courseStatus).toEqual('loaded'); - expect(state).toMatchSnapshot({ + expect(state).toEqual(expect.objectContaining({ // The Xpert chatbot (frontend-lib-learning-assistant) generates a unique UUID - // to keep track of conversations. This causes snapshots to fail, because this UUID - // is generated on each run of the snapshot. Instead, we use an asymmetric matcher here. + // to keep track of conversations. This UUID is generated on each run. + // Instead, we use an asymmetric matcher here. learningAssistant: expect.objectContaining({ conversationId: expect.any(String), }), - }); + })); }); it.each([401, 403, 404])( @@ -137,14 +137,14 @@ describe('Data layer integration tests', () => { const state = store.getState(); expect(state.courseHome.courseStatus).toEqual('loaded'); - expect(state).toMatchSnapshot({ + expect(state).toEqual(expect.objectContaining({ // The Xpert chatbot (frontend-lib-learning-assistant) generates a unique UUID - // to keep track of conversations. This causes snapshots to fail, because this UUID - // is generated on each run of the snapshot. Instead, we use an asymmetric matcher here. + // to keep track of conversations. This UUID is generated on each run. + // Instead, we use an asymmetric matcher here. learningAssistant: expect.objectContaining({ conversationId: expect.any(String), }), - }); + })); }); it.each([401, 403, 404])( @@ -185,14 +185,14 @@ describe('Data layer integration tests', () => { const state = store.getState(); expect(state.courseHome.courseStatus).toEqual('loaded'); - expect(state).toMatchSnapshot({ + expect(state).toEqual(expect.objectContaining({ // The Xpert chatbot (frontend-lib-learning-assistant) generates a unique UUID - // to keep track of conversations. This causes snapshots to fail, because this UUID - // is generated on each run of the snapshot. Instead, we use an asymmetric matcher here. + // to keep track of conversations. This UUID is generated on each run. + // Instead, we use an asymmetric matcher here. learningAssistant: expect.objectContaining({ conversationId: expect.any(String), }), - }); + })); }); it('Should handle the url including a targetUserId', async () => { diff --git a/src/decode-page-route/__snapshots__/index.test.jsx.snap b/src/decode-page-route/__snapshots__/index.test.jsx.snap deleted file mode 100644 index 9a9bd772fa..0000000000 --- a/src/decode-page-route/__snapshots__/index.test.jsx.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DecodePageRoute should not modify the url if it does not need to be decoded 1`] = ` -
- PageWrap: { - "children": [ - " ", - [ - " ", - [], - " " - ], - " " - ] -} -
-`; diff --git a/src/decode-page-route/index.test.jsx b/src/decode-page-route/index.test.jsx index 8abf352dbd..81f22517a8 100644 --- a/src/decode-page-route/index.test.jsx +++ b/src/decode-page-route/index.test.jsx @@ -62,11 +62,10 @@ describe('DecodePageRoute', () => { const props = matchPath({ path: '/course/:courseId/home', }, `/course/${decodedCourseId}/home`); - const { container } = renderPage(props); + renderPage(props); expect(props.pathname).toContain(decodedCourseId); expect(mockNavigate).not.toHaveBeenCalled(); - expect(container).toMatchSnapshot(); }); it('should decode the url and replace the history if necessary', () => {