File tree Expand file tree Collapse file tree 3 files changed +36
-7
lines changed
components/CourseGlimpseList
pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid
widgets/Dashboard/hooks/useDashboardRouter Expand file tree Collapse file tree 3 files changed +36
-7
lines changed Original file line number Diff line number Diff line change 1- import { render , screen } from '@testing-library/react' ;
21import { IntlProvider } from 'react-intl' ;
3-
4- import { RichieContextFactory , CourseLightFactory } from 'utils/test/factories/richie' ;
5- import { CommonDataProps } from 'types/commonDataProps' ;
2+ import { render , screen } from '@testing-library/react' ;
63import { CourseStateTextEnum , Priority } from 'types' ;
4+ import { CommonDataProps } from 'types/commonDataProps' ;
5+ import {
6+ CourseLightFactory ,
7+ RichieContextFactory as mockRichieContextFactory ,
8+ } from 'utils/test/factories/richie' ;
9+
710import { CourseGlimpseList , getCourseGlimpseListProps } from '.' ;
811
12+ jest . mock ( 'utils/context' , ( ) => ( {
13+ __esModule : true ,
14+ default : mockRichieContextFactory ( {
15+ joanie_backend : { endpoint : 'https://joanie.endpoint' } ,
16+ } ) . one ( ) ,
17+ } ) ) ;
18+
919describe ( 'widgets/Search/components/CourseGlimpseList' , ( ) => {
10- const contextProps : CommonDataProps [ 'context' ] = RichieContextFactory ( ) . one ( ) ;
20+ const contextProps : CommonDataProps [ 'context' ] = mockRichieContextFactory ( ) . one ( ) ;
1121
1222 it ( 'renders a list of Courses into a list of CourseGlimpses' , ( ) => {
1323 const courses = [
Original file line number Diff line number Diff line change 11import { createIntl } from 'react-intl' ;
2- import { screen } from '@testing-library/react' ;
3- import { getAllByRole , within } from '@testing-library/dom' ;
42import { faker } from '@faker-js/faker' ;
3+ import { getAllByRole , within } from '@testing-library/dom' ;
4+ import { screen } from '@testing-library/react' ;
55import { NestedCourseOrderFactory } from 'utils/test/factories/joanieLegacy' ;
66import { expectNoSpinner } from 'utils/test/expectSpinner' ;
77import { PaginationFactory } from 'utils/test/factories/cunningham' ;
88import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat' ;
9+ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie' ;
910import { OrderState } from 'types/Joanie' ;
1011import { render } from 'utils/test/render' ;
1112import { PresentationalAppWrapper } from 'utils/test/wrappers/PresentationalAppWrapper' ;
13+
1214import CourseLearnerDataGrid from '.' ;
1315
16+ jest . mock ( 'utils/context' , ( ) => ( {
17+ __esModule : true ,
18+ default : mockRichieContextFactory ( {
19+ joanie_backend : { endpoint : 'https://joanie.endpoint' } ,
20+ } ) . one ( ) ,
21+ } ) ) ;
22+
1423describe ( 'pages/CourseLearnerDataGrid' , ( ) => {
1524 it ( 'should render a list of user' , async ( ) => {
1625 const courseOrderList = NestedCourseOrderFactory ( {
Original file line number Diff line number Diff line change 11import { PropsWithChildren } from 'react' ;
2+
23import { IntlProvider } from 'react-intl' ;
34import { renderHook } from '@testing-library/react' ;
5+ import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie' ;
6+
47import useDashboardRoutes from '.' ;
58
9+ jest . mock ( 'utils/context' , ( ) => ( {
10+ __esModule : true ,
11+ default : mockRichieContextFactory ( {
12+ joanie_backend : { endpoint : 'https://joanie.endpoint' } ,
13+ } ) . one ( ) ,
14+ } ) ) ;
15+
616describe ( 'useDashboardRouter' , ( ) => {
717 const Wrapper = ( { children } : PropsWithChildren < { } > ) => (
818 < IntlProvider locale = "en" > { children } </ IntlProvider >
You can’t perform that action at this time.
0 commit comments