diff --git a/src/components/Disclosure/__snapshots__/Disclosure.test.jsx.snap b/src/components/Disclosure/__snapshots__/index.test.jsx.snap similarity index 100% rename from src/components/Disclosure/__snapshots__/Disclosure.test.jsx.snap rename to src/components/Disclosure/__snapshots__/index.test.jsx.snap diff --git a/src/components/Disclosure/Disclosure.test.jsx b/src/components/Disclosure/index.test.jsx similarity index 100% rename from src/components/Disclosure/Disclosure.test.jsx rename to src/components/Disclosure/index.test.jsx index abcb92d6..a08d3f7d 100644 --- a/src/components/Disclosure/Disclosure.test.jsx +++ b/src/components/Disclosure/index.test.jsx @@ -8,17 +8,17 @@ import TrialDisclosure from '.'; const mockedUpgradeUrl = 'https://upgrade.edx/course/test'; const mockedAuditTrialDays = 7; -jest.mock('../../hooks', () => ({ - useCourseUpgrade: jest.fn(), - useTrackEvent: jest.fn(() => ({ track: jest.fn() })), -})); - const PRIVACY_POLICY_URL = 'https://some.url/policy'; jest.mock('@edx/frontend-platform/config', () => ({ ensureConfig: jest.fn(), getConfig: () => ({ PRIVACY_POLICY_URL }), })); +jest.mock('../../hooks', () => ({ + useCourseUpgrade: jest.fn(), + useTrackEvent: jest.fn(() => ({ track: jest.fn() })), +})); + describe('', () => { let container; diff --git a/src/hooks/use-course-upgrade.test.jsx b/src/hooks/use-course-upgrade.test.jsx index 2bb4aeb7..92895fda 100644 --- a/src/hooks/use-course-upgrade.test.jsx +++ b/src/hooks/use-course-upgrade.test.jsx @@ -4,7 +4,6 @@ import { useModel } from '@src/generic/model-store'; // eslint-disable-line impo import { CourseInfoProvider } from '../context'; import useCourseUpgrade from './use-course-upgrade'; -jest.mock('@src/generic/model-store', () => ({ useModel: jest.fn() }), { virtual: true }); jest.mock('react-redux', () => ({ useSelector: jest.fn() })); const mockedUpgradeUrl = 'https://upgrade.edx/course/test'; diff --git a/src/hooks/use-track-event.test.jsx b/src/hooks/use-track-event.test.jsx index 846f356f..8c0f8471 100644 --- a/src/hooks/use-track-event.test.jsx +++ b/src/hooks/use-track-event.test.jsx @@ -32,7 +32,7 @@ const renderHook = ({ { wrapper: contextWrapper({ courseInfo }) }, ); -describe('useCourseUpgrade()', () => { +describe('useTrackEvent()', () => { afterEach(() => jest.resetAllMocks()); it('should return a track method that calls sendTrackEvent with the contextual information', () => { diff --git a/src/setupTest.js b/src/setupTest.js index 9954a7a3..57647f19 100644 --- a/src/setupTest.js +++ b/src/setupTest.js @@ -1,6 +1,13 @@ import '@testing-library/jest-dom'; import { mergeConfig } from '@edx/frontend-platform'; +jest.mock('./hooks', () => ({ + useCourseUpgrade: () => ({ upgradeable: false }), + useTrackEvent: () => ({ track: () => {} }), +})); + +jest.mock('@src/generic/model-store', () => ({ useModel: jest.fn() }), { virtual: true }); + mergeConfig({ ...process.env, });