diff --git a/src/frontend/js/components/CourseGlimpseList/index.spec.tsx b/src/frontend/js/components/CourseGlimpseList/index.spec.tsx index 30be224b0a..bd7548b2f9 100644 --- a/src/frontend/js/components/CourseGlimpseList/index.spec.tsx +++ b/src/frontend/js/components/CourseGlimpseList/index.spec.tsx @@ -1,13 +1,23 @@ -import { render, screen } from '@testing-library/react'; import { IntlProvider } from 'react-intl'; - -import { RichieContextFactory, CourseLightFactory } from 'utils/test/factories/richie'; -import { CommonDataProps } from 'types/commonDataProps'; +import { render, screen } from '@testing-library/react'; import { CourseStateTextEnum, Priority } from 'types'; +import { CommonDataProps } from 'types/commonDataProps'; +import { + CourseLightFactory, + RichieContextFactory as mockRichieContextFactory, +} from 'utils/test/factories/richie'; + import { CourseGlimpseList, getCourseGlimpseListProps } from '.'; +jest.mock('utils/context', () => ({ + __esModule: true, + default: mockRichieContextFactory({ + joanie_backend: { endpoint: 'https://joanie.endpoint' }, + }).one(), +})); + describe('widgets/Search/components/CourseGlimpseList', () => { - const contextProps: CommonDataProps['context'] = RichieContextFactory().one(); + const contextProps: CommonDataProps['context'] = mockRichieContextFactory().one(); it('renders a list of Courses into a list of CourseGlimpses', () => { const courses = [ diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx index 6dd41b9056..0da3da6cab 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx @@ -1,16 +1,25 @@ import { createIntl } from 'react-intl'; -import { screen } from '@testing-library/react'; -import { getAllByRole, within } from '@testing-library/dom'; import { faker } from '@faker-js/faker'; +import { getAllByRole, within } from '@testing-library/dom'; +import { screen } from '@testing-library/react'; import { NestedCourseOrderFactory } from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { PaginationFactory } from 'utils/test/factories/cunningham'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; +import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { OrderState } from 'types/Joanie'; import { render } from 'utils/test/render'; import { PresentationalAppWrapper } from 'utils/test/wrappers/PresentationalAppWrapper'; + import CourseLearnerDataGrid from '.'; +jest.mock('utils/context', () => ({ + __esModule: true, + default: mockRichieContextFactory({ + joanie_backend: { endpoint: 'https://joanie.endpoint' }, + }).one(), +})); + describe('pages/CourseLearnerDataGrid', () => { it('should render a list of user', async () => { const courseOrderList = NestedCourseOrderFactory({ diff --git a/src/frontend/js/widgets/Dashboard/hooks/useDashboardRouter/index.spec.tsx b/src/frontend/js/widgets/Dashboard/hooks/useDashboardRouter/index.spec.tsx index d6d45d05a1..3840141e2c 100644 --- a/src/frontend/js/widgets/Dashboard/hooks/useDashboardRouter/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/hooks/useDashboardRouter/index.spec.tsx @@ -1,8 +1,18 @@ import { PropsWithChildren } from 'react'; + import { IntlProvider } from 'react-intl'; import { renderHook } from '@testing-library/react'; +import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; + import useDashboardRoutes from '.'; +jest.mock('utils/context', () => ({ + __esModule: true, + default: mockRichieContextFactory({ + joanie_backend: { endpoint: 'https://joanie.endpoint' }, + }).one(), +})); + describe('useDashboardRouter', () => { const Wrapper = ({ children }: PropsWithChildren<{}>) => ( {children}