From 62dd7d8c9fcdc7e413a5ce7e2125f531effafcc0 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi Date: Wed, 13 Sep 2023 14:12:59 +0500 Subject: [PATCH] fix: test cases affectewd due to lib-special-exams --- src/courseware/course/Course.test.jsx | 4 ++++ src/courseware/course/CourseBreadcrumbs.test.jsx | 8 +------- src/courseware/course/sequence/Sequence.test.jsx | 4 ++++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/courseware/course/Course.test.jsx b/src/courseware/course/Course.test.jsx index 62d3084cf6..d2c60d8fbe 100644 --- a/src/courseware/course/Course.test.jsx +++ b/src/courseware/course/Course.test.jsx @@ -15,6 +15,10 @@ import { executeThunk } from '../../utils'; import * as thunks from '../data/thunks'; jest.mock('@edx/frontend-platform/analytics'); +jest.mock('@edx/frontend-lib-special-exams/dist/data/thunks.js', () => ({ + ...jest.requireActual('@edx/frontend-lib-special-exams/dist/data/thunks.js'), + checkExamEntry: () => jest.fn(), +})); const recordFirstSectionCelebration = jest.fn(); // eslint-disable-next-line no-import-assign diff --git a/src/courseware/course/CourseBreadcrumbs.test.jsx b/src/courseware/course/CourseBreadcrumbs.test.jsx index 614538df1e..c85d829701 100644 --- a/src/courseware/course/CourseBreadcrumbs.test.jsx +++ b/src/courseware/course/CourseBreadcrumbs.test.jsx @@ -26,12 +26,6 @@ jest.mock('react-redux', () => ({ Provider: ({ children }) => children, useSelector: () => 'loaded', })); -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - Link: jest.fn().mockImplementation(({ to, children }) => ( - {children} - )), -})); useModels.mockImplementation((name) => { if (name === 'sections') { @@ -121,7 +115,7 @@ describe('CourseBreadcrumbs', () => { sequenceId="block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions" isStaff /> - + , , ); it('renders course breadcrumbs as expected', async () => { diff --git a/src/courseware/course/sequence/Sequence.test.jsx b/src/courseware/course/sequence/Sequence.test.jsx index 4dc0291aad..dea0649d83 100644 --- a/src/courseware/course/sequence/Sequence.test.jsx +++ b/src/courseware/course/sequence/Sequence.test.jsx @@ -11,6 +11,10 @@ import Sequence from './Sequence'; import { fetchSequenceFailure } from '../../data/slice'; jest.mock('@edx/frontend-platform/analytics'); +jest.mock('@edx/frontend-lib-special-exams/dist/data/thunks.js', () => ({ + ...jest.requireActual('@edx/frontend-lib-special-exams/dist/data/thunks.js'), + checkExamEntry: () => jest.fn(), +})); describe('Sequence', () => { let mockData;