From 74a09d60c4285ffeb9ba15c4f004f3964852fb71 Mon Sep 17 00:00:00 2001 From: Romain Le Cellier Date: Tue, 21 Nov 2023 14:08:22 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=9A(frontend)=20api/joanie=20as=20?= =?UTF-8?q?joanieLegacyClient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We'll implement a api client generated from joanie's openApi schema. The current client needs to change place. --- src/frontend/js/api/joanie/index.ts | 15 +++++++++++++++ .../joanieLegacyClient.spec.ts} | 2 +- .../{joanie.ts => joanie/joanieLegacyClient.ts} | 5 ----- src/frontend/js/api/lms/joanie.ts | 2 +- .../js/contexts/JoanieApiContext/index.tsx | 4 ++-- .../js/contexts/SessionContext/index.spec.tsx | 4 ++-- .../js/hooks/useCourseProductUnion/index.spec.tsx | 6 +++--- .../react-query/useSessionMutation/index.spec.tsx | 4 ++-- .../react-query/useSessionQuery/index.spec.tsx | 10 +++++++--- src/frontend/mocks/handlers/contracts.ts | 4 ++-- 10 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 src/frontend/js/api/joanie/index.ts rename src/frontend/js/api/{joanie.spec.ts => joanie/joanieLegacyClient.spec.ts} (97%) rename src/frontend/js/api/{joanie.ts => joanie/joanieLegacyClient.ts} (99%) diff --git a/src/frontend/js/api/joanie/index.ts b/src/frontend/js/api/joanie/index.ts new file mode 100644 index 0000000000..5f427251b5 --- /dev/null +++ b/src/frontend/js/api/joanie/index.ts @@ -0,0 +1,15 @@ +import context from 'utils/context'; + +/** + * Flag which determines if joanie is enabled. + */ +export const isJoanieEnabled = !!context.joanie_backend; + +export { + default as JoanieLegacyClient, + getResponseBody as getResponseBodyLegacy, + checkStatus as checkStatusLegacy, + getAPIEndpoint as getAPIEndpointLegacy, + getRoutes as getRoutesLegacy, + buildApiUrl as buildApiUrlLegacy, +} from './joanieLegacyClient'; diff --git a/src/frontend/js/api/joanie.spec.ts b/src/frontend/js/api/joanie/joanieLegacyClient.spec.ts similarity index 97% rename from src/frontend/js/api/joanie.spec.ts rename to src/frontend/js/api/joanie/joanieLegacyClient.spec.ts index f8fc89317d..84e6e664b8 100644 --- a/src/frontend/js/api/joanie.spec.ts +++ b/src/frontend/js/api/joanie/joanieLegacyClient.spec.ts @@ -1,7 +1,7 @@ import fetchMock from 'fetch-mock'; import { ResourcesQuery } from 'hooks/useResources'; import { HttpStatusCode } from 'utils/errors/HttpError'; -import { buildApiUrl, getResponseBody } from './joanie'; +import { buildApiUrl, getResponseBody } from './joanieLegacyClient'; describe('api/joanie', () => { it('getResponse should handle empty response body', async () => { diff --git a/src/frontend/js/api/joanie.ts b/src/frontend/js/api/joanie/joanieLegacyClient.ts similarity index 99% rename from src/frontend/js/api/joanie.ts rename to src/frontend/js/api/joanie/joanieLegacyClient.ts index c58bd429ac..c7834a763c 100644 --- a/src/frontend/js/api/joanie.ts +++ b/src/frontend/js/api/joanie/joanieLegacyClient.ts @@ -206,11 +206,6 @@ export const getRoutes = () => { }; }; -/** - * Flag which determines if joanie is enabled. - */ -export const isJoanieEnabled = !!context.joanie_backend; - const filterEmptyEntry = ([, value]: [PropertyKey, any]) => { if (value == null) return false; // Value is null/undefined if (value?.length !== undefined && value.length === 0) return false; // Value is an empty array/string diff --git a/src/frontend/js/api/lms/joanie.ts b/src/frontend/js/api/lms/joanie.ts index 56cc11fd57..3e19c9875f 100644 --- a/src/frontend/js/api/lms/joanie.ts +++ b/src/frontend/js/api/lms/joanie.ts @@ -1,5 +1,5 @@ import { matchPath, PathMatch } from 'react-router-dom'; -import JoanieApi from 'api/joanie'; +import { JoanieLegacyClient as JoanieApi } from 'api/joanie'; import { LMSBackend } from 'types/commonDataProps'; import { APIBackend, APILms } from 'types/api'; diff --git a/src/frontend/js/contexts/JoanieApiContext/index.tsx b/src/frontend/js/contexts/JoanieApiContext/index.tsx index 11e62cba32..4d2bf88b7f 100644 --- a/src/frontend/js/contexts/JoanieApiContext/index.tsx +++ b/src/frontend/js/contexts/JoanieApiContext/index.tsx @@ -1,7 +1,7 @@ import type { PropsWithChildren } from 'react'; import { createContext, useContext } from 'react'; import type * as Joanie from 'types/Joanie'; -import API from 'api/joanie'; +import { JoanieLegacyClient as JoanieApi } from 'api/joanie'; import type { Maybe } from 'types/utils'; const JoanieApiContext = createContext>(undefined); @@ -10,7 +10,7 @@ const JoanieApiContext = createContext>(undefined); * Provider to access to the Joanie API interface. */ const JoanieApiProvider = ({ children }: PropsWithChildren<{}>) => { - const api = API(); + const api = JoanieApi(); return {children}; }; diff --git a/src/frontend/js/contexts/SessionContext/index.spec.tsx b/src/frontend/js/contexts/SessionContext/index.spec.tsx index f6a634e4df..9d29fc5ccd 100644 --- a/src/frontend/js/contexts/SessionContext/index.spec.tsx +++ b/src/frontend/js/contexts/SessionContext/index.spec.tsx @@ -56,7 +56,7 @@ describe('SessionProvider', () => { }); it('uses BaseSessionProvider if joanie is disabled', async () => { - jest.doMock('api/joanie.ts', () => ({ + jest.doMock('api/joanie/index.ts', () => ({ isJoanieEnabled: false, })); jest.doMock('./BaseSessionProvider', () => ({ @@ -75,7 +75,7 @@ describe('SessionProvider', () => { }); it('uses JoanieSessionProvider if joanie is enabled', async () => { - jest.doMock('api/joanie.ts', () => ({ + jest.doMock('api/joanie/index.ts', () => ({ isJoanieEnabled: true, })); jest.doMock('./BaseSessionProvider', () => ({ diff --git a/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx b/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx index 5ae0d1d0d8..20bb064a45 100644 --- a/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx +++ b/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx @@ -8,7 +8,7 @@ import { History, HistoryContext } from 'hooks/useHistory'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { SessionProvider } from 'contexts/SessionContext'; -import { getRoutes } from 'api/joanie'; +import { getRoutesLegacy } from 'api/joanie'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; import { CourseListItemFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; import { useCourseProductUnion } from '.'; @@ -74,7 +74,7 @@ describe('useCourseProductUnion', () => { }); it('should call courses and coursesProductRelation endpoints', async () => { - const ROUTES = getRoutes(); + const ROUTES = getRoutesLegacy(); const coursesUrl = ROUTES.courses.get.replace(':id/', ''); const courseProductRelationsUrl = ROUTES.courseProductRelations.get.replace(':id/', ''); fetchMock.get( @@ -100,7 +100,7 @@ describe('useCourseProductUnion', () => { it('should call organization courses and organization coursesProductRelation endpoints', async () => { const organizationId = 'DUMMY_ORGANIZATION_ID'; - const ROUTES = getRoutes(); + const ROUTES = getRoutesLegacy(); const organizationCoursesUrl = ROUTES.organizations.courses.get .replace(':organization_id', organizationId) .replace(':id/', ''); diff --git a/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx b/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx index ecd9d195ca..75c663dfba 100644 --- a/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx +++ b/src/frontend/js/utils/react-query/useSessionMutation/index.spec.tsx @@ -5,7 +5,7 @@ import { renderHook, waitFor } from '@testing-library/react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import BaseSessionProvider from 'contexts/SessionContext/BaseSessionProvider'; import { useSession } from 'contexts/SessionContext'; -import { checkStatus } from 'api/joanie'; +import { checkStatusLegacy } from 'api/joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { HttpStatusCode } from 'utils/errors/HttpError'; import { useSessionMutation } from '.'; @@ -41,7 +41,7 @@ describe('useSessionMutation', () => { const session = useSession(); const mutation = useSessionMutation({ mutationFn: () => - fetch('http://api.endpoint/orders/create', { method: 'POST' }).then(checkStatus), + fetch('http://api.endpoint/orders/create', { method: 'POST' }).then(checkStatusLegacy), onError: handleError, }); diff --git a/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx b/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx index 042c456579..8be4a75e67 100644 --- a/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx +++ b/src/frontend/js/utils/react-query/useSessionQuery/index.spec.tsx @@ -4,7 +4,7 @@ import { PropsWithChildren } from 'react'; import { renderHook, waitFor } from '@testing-library/react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import BaseSessionProvider from 'contexts/SessionContext/BaseSessionProvider'; -import { checkStatus } from 'api/joanie'; +import { checkStatusLegacy } from 'api/joanie'; import { useSession } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { HttpError, HttpStatusCode } from 'utils/errors/HttpError'; @@ -43,7 +43,9 @@ describe('useSessionQuery', () => { const useHooks = () => { const session = useSession(); - useSessionQuery(['orders'], () => fetch('http://api.endpoint/orders/').then(checkStatus)); + useSessionQuery(['orders'], () => + fetch('http://api.endpoint/orders/').then(checkStatusLegacy), + ); return session; }; @@ -73,7 +75,9 @@ describe('useSessionQuery', () => { const useHooks = () => { const session = useSession(); - useSessionQuery(['orders'], () => fetch('http://api.endpoint/orders/').then(checkStatus)); + useSessionQuery(['orders'], () => + fetch('http://api.endpoint/orders/').then(checkStatusLegacy), + ); return session; }; diff --git a/src/frontend/mocks/handlers/contracts.ts b/src/frontend/mocks/handlers/contracts.ts index 0eeb51786c..04c73e48de 100644 --- a/src/frontend/mocks/handlers/contracts.ts +++ b/src/frontend/mocks/handlers/contracts.ts @@ -1,11 +1,11 @@ import { http, HttpResponse } from 'msw'; -import { getAPIEndpoint } from 'api/joanie'; +import { getAPIEndpointLegacy } from 'api/joanie'; import { Contract, PaginatedResponse } from 'types/Joanie'; import { ContractFactory } from 'utils/test/factories/joanie'; import { PER_PAGE } from 'settings'; export default [ - http.get(`${getAPIEndpoint()}/contracts/`, () => { + http.get(`${getAPIEndpointLegacy()}/contracts/`, () => { return HttpResponse.json>({ count: 250, results: ContractFactory().many(PER_PAGE.teacherContractList), From 425b7726360873178f1b72bbf57bc0b0332f1598 Mon Sep 17 00:00:00 2001 From: Romain Le Cellier Date: Wed, 6 Mar 2024 16:32:16 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=9A(frontend)=20factories/joanie?= =?UTF-8?q?=20as=20joanieLegacy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We'll implement a api client generated from joanie's openApi schema. The current client's type factories needs to change place. --- .../AddressesManagement/AddressForm/index.spec.tsx | 2 +- .../AddressesManagement/AddressForm/index.stories.tsx | 2 +- .../js/components/AddressesManagement/index.spec.tsx | 2 +- .../components/ContractFrame/LearnerContractFrame.spec.tsx | 2 +- .../ContractFrame/OrganizationContractFrame.spec.tsx | 2 +- src/frontend/js/components/ContractStatus/index.spec.tsx | 2 +- .../js/components/DownloadContractButton/index.spec.tsx | 2 +- .../components/PaymentInterfaces/index.spec.tsx | 2 +- src/frontend/js/components/PaymentButton/index.spec.tsx | 2 +- src/frontend/js/components/PurchaseButton/index.spec.tsx | 2 +- src/frontend/js/components/PurchaseButton/index.stories.tsx | 2 +- src/frontend/js/components/RegisteredAddress/index.spec.tsx | 2 +- .../js/components/RegisteredAddress/index.stories.tsx | 2 +- .../components/RegisteredCreditCard/index.spec.tsx | 2 +- .../components/SaleTunnelStepPayment/index.spec.tsx | 2 +- .../components/SaleTunnelStepResume/index.spec.tsx | 2 +- .../components/SaleTunnelStepValidation/index.spec.tsx | 2 +- src/frontend/js/components/SaleTunnel/index.spec.tsx | 2 +- .../SignContractButton/index.omniscientOrders.spec.tsx | 2 +- .../js/components/SignContractButton/index.spec.tsx | 2 +- .../js/components/TeacherDashboardCourseList/index.spec.tsx | 2 +- src/frontend/js/hooks/useContractAbilities/index.spec.ts | 2 +- src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx | 5 ++++- src/frontend/js/hooks/useCourses/index.spec.tsx | 2 +- src/frontend/js/hooks/useCreditCards/index.spec.tsx | 2 +- .../js/hooks/useDefaultOrganizationId/index.spec.tsx | 2 +- src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx | 2 +- src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx | 2 +- src/frontend/js/hooks/useProductOrder/index.spec.tsx | 2 +- .../DashboardCreateAddress.spec.tsx | 2 +- .../DashboardEditAddress.spec.tsx | 2 +- .../DashboardEditAddress.stories.tsx | 2 +- .../js/pages/DashboardAddressesManagement/index.spec.tsx | 2 +- src/frontend/js/pages/DashboardCertificates/index.spec.tsx | 2 +- src/frontend/js/pages/DashboardContracts/index.spec.tsx | 2 +- src/frontend/js/pages/DashboardCourses/index.spec.tsx | 2 +- .../CreditCardBrandLogo.stories.tsx | 2 +- .../DashboardEditCreditCard.spec.tsx | 2 +- .../DashboardEditCreditCard.stories.tsx | 2 +- .../js/pages/DashboardCreditCardsManagement/index.spec.tsx | 2 +- src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx | 2 +- .../TeacherDashboardContracts/index.spec.tsx | 2 +- .../components/ContractFiltersBar/index.spec.tsx | 2 +- .../hooks/useHasContractToDownload/index.spec.tsx | 2 +- .../hooks/useTeacherContractFilters/index.spec.tsx | 5 ++++- .../components/CourseLearnerDataGrid/index.spec.tsx | 2 +- .../components/CourseLearnersFiltersBar/index.spec.tsx | 2 +- .../hooks/useCourseLearnersFilters/index.spec.tsx | 5 ++++- .../TeacherDashboardCourseLearnersLayout/index.spec.tsx | 2 +- .../CourseRunList/index.spec.tsx | 2 +- .../CourseRunList/utils.spec.tsx | 2 +- .../js/pages/TeacherDashboardCoursesLoader/index.spec.tsx | 5 ++++- .../js/pages/TeacherDashboardTraining/index.spec.tsx | 5 ++++- .../js/utils/AbilitiesHelper/contractAbilities.spec.ts | 2 +- .../AbilitiesHelper/joanieUserProfileAbilities.spec.ts | 2 +- src/frontend/js/utils/ContractHelper/index.spec.ts | 2 +- src/frontend/js/utils/CoursesHelper/index.spec.ts | 2 +- src/frontend/js/utils/CreditCardHelper/index.spec.tsx | 2 +- src/frontend/js/utils/ProductHelper/index.spec.ts | 6 +++++- .../test/factories/{joanie.spec.ts => joanieLegacy.spec.ts} | 2 +- .../js/utils/test/factories/{joanie.ts => joanieLegacy.ts} | 0 src/frontend/js/utils/test/mockCourseProductWithOrder.ts | 2 +- .../Dashboard/components/DashboardAvatar/index.spec.tsx | 2 +- .../Dashboard/components/DashboardAvatar/index.stories.tsx | 2 +- .../components/DashboardItem/Certificate/index.spec.tsx | 2 +- .../components/DashboardItem/Certificate/index.stories.tsx | 2 +- .../DashboardItem/CertificateStatus/index.spec.tsx | 2 +- .../components/DashboardItem/Contract/index.spec.tsx | 2 +- .../components/DashboardItem/Contract/index.stories.tsx | 2 +- .../components/DashboardItem/CourseEnrolling/index.spec.tsx | 2 +- .../DashboardItem/CourseEnrolling/index.stories.tsx | 2 +- .../Enrollment/DashboardItemEnrollment.spec.tsx | 2 +- .../Enrollment/ProductCertificateFooter/index.spec.tsx | 5 +++-- .../DashboardItem/Order/DashboardItemOrder.spec.tsx | 2 +- .../DashboardItem/Order/DashboardItemOrderContract.spec.tsx | 2 +- ...shboardItemOrderContract.useUnionResource.cache.spec.tsx | 2 +- .../Order/DashboardItemOrderReadonly.stories.tsx | 2 +- .../Order/DashboardItemOrderWritable.stories.tsx | 2 +- .../Order/OrderStateLearnerMessage/index.spec.tsx | 2 +- .../Order/OrderStateTeacherMessage/index.spec.tsx | 2 +- .../components/ContractNavLink/index.spec.tsx | 2 +- .../components/TeacherDashboardCourseSidebar/index.spec.tsx | 2 +- .../TeacherDashboardOrganizationSidebar/index.spec.tsx | 2 +- .../TeacherDashboardOrganizationSidebar/index.stories.tsx | 2 +- .../components/OrganizationLinks/index.spec.tsx | 2 +- .../TeacherDashboardProfileSidebar/index.spec.tsx | 2 +- .../js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx | 2 +- src/frontend/js/widgets/Dashboard/index.spec.tsx | 2 +- .../components/CourseProductCertificateItem/index.spec.tsx | 5 ++++- .../CourseProductCertificateItem/index.stories.tsx | 5 ++++- .../components/CourseProductCourseRuns/index.spec.tsx | 2 +- .../components/CourseRunItem/index.spec.tsx | 2 +- .../components/CourseRunItem/index.stories.tsx | 2 +- .../components/CourseProductItem/index.spec.tsx | 2 +- .../components/CourseProductItem/index.stories.tsx | 2 +- .../components/CourseRunEnrollment/index.joanie.spec.tsx | 2 +- .../components/CourseWishButton/index.login.spec.tsx | 2 +- .../components/CourseWishButton/index.logout.spec.tsx | 2 +- .../js/widgets/SyllabusCourseRunsList/index.spec.tsx | 5 ++++- src/frontend/js/widgets/UserLogin/index.spec.tsx | 2 +- src/frontend/mocks/handlers/contracts.ts | 2 +- 101 files changed, 130 insertions(+), 101 deletions(-) rename src/frontend/js/utils/test/factories/{joanie.spec.ts => joanieLegacy.spec.ts} (78%) rename src/frontend/js/utils/test/factories/{joanie.ts => joanieLegacy.ts} (100%) diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx b/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx index 08e94afb61..201f41236f 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx +++ b/src/frontend/js/components/AddressesManagement/AddressForm/index.spec.tsx @@ -4,7 +4,7 @@ import countries from 'i18n-iso-countries'; import { CunninghamProvider } from '@openfun/cunningham-react'; import userEvent, { UserEvent } from '@testing-library/user-event'; import { Address } from 'types/Joanie'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { changeSelect, clearSelect } from 'components/Form/test-utils'; import AddressForm from './index'; diff --git a/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx b/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx index 75248c8070..128c4c3c9a 100644 --- a/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx +++ b/src/frontend/js/components/AddressesManagement/AddressForm/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import AddressForm from '.'; export default { diff --git a/src/frontend/js/components/AddressesManagement/index.spec.tsx b/src/frontend/js/components/AddressesManagement/index.spec.tsx index d4106ebca2..17a4f10a48 100644 --- a/src/frontend/js/components/AddressesManagement/index.spec.tsx +++ b/src/frontend/js/components/AddressesManagement/index.spec.tsx @@ -10,7 +10,7 @@ import { PropsWithChildren } from 'react'; import { CunninghamProvider } from '@openfun/cunningham-react'; import userEvent, { UserEvent } from '@testing-library/user-event'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import type * as Joanie from 'types/Joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx b/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx index 78ef3a3e8a..166c8dd837 100644 --- a/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx +++ b/src/frontend/js/components/ContractFrame/LearnerContractFrame.spec.tsx @@ -6,7 +6,7 @@ import { IntlProvider } from 'react-intl'; import fetchMock from 'fetch-mock'; import { QueryStateFactory } from 'utils/test/factories/reactQuery'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { Props } from './AbstractContractFrame'; diff --git a/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx b/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx index 2d6992f105..9dc4e70fb9 100644 --- a/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx +++ b/src/frontend/js/components/ContractFrame/OrganizationContractFrame.spec.tsx @@ -10,7 +10,7 @@ import { ContractFactory, CourseProductRelationFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { isCourseProductRelation } from 'types/Joanie'; diff --git a/src/frontend/js/components/ContractStatus/index.spec.tsx b/src/frontend/js/components/ContractStatus/index.spec.tsx index a5cb629b9b..8b191f88bc 100644 --- a/src/frontend/js/components/ContractStatus/index.spec.tsx +++ b/src/frontend/js/components/ContractStatus/index.spec.tsx @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react'; import { PropsWithChildren } from 'react'; import { IntlProvider, createIntl } from 'react-intl'; import { faker } from '@faker-js/faker'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; import ContractStatus from '.'; diff --git a/src/frontend/js/components/DownloadContractButton/index.spec.tsx b/src/frontend/js/components/DownloadContractButton/index.spec.tsx index e7c0b85898..e19b6a77cc 100644 --- a/src/frontend/js/components/DownloadContractButton/index.spec.tsx +++ b/src/frontend/js/components/DownloadContractButton/index.spec.tsx @@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event'; import { QueryClientProvider } from '@tanstack/react-query'; import fetchMock from 'fetch-mock'; import { faker } from '@faker-js/faker'; -import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieApiProvider from 'contexts/JoanieApiContext'; diff --git a/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx b/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx index cccdba58e7..cd9223198e 100644 --- a/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx +++ b/src/frontend/js/components/PaymentButton/components/PaymentInterfaces/index.spec.tsx @@ -3,7 +3,7 @@ import type * as Joanie from 'types/Joanie'; import { PaymentProviders } from 'types/Joanie'; import { handle as mockHandle } from 'utils/errors/handle'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { PaymentFactory } from 'utils/test/factories/joanie'; +import { PaymentFactory } from 'utils/test/factories/joanieLegacy'; import PaymentInterface from '.'; jest.mock('./PayplugLightbox', () => ({ diff --git a/src/frontend/js/components/PaymentButton/index.spec.tsx b/src/frontend/js/components/PaymentButton/index.spec.tsx index a83517235e..818591c18f 100644 --- a/src/frontend/js/components/PaymentButton/index.spec.tsx +++ b/src/frontend/js/components/PaymentButton/index.spec.tsx @@ -18,7 +18,7 @@ import { OrderGroupFactory, CourseLightFactory, EnrollmentFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { PAYMENT_SETTINGS } from 'settings'; import type * as Joanie from 'types/Joanie'; import { diff --git a/src/frontend/js/components/PurchaseButton/index.spec.tsx b/src/frontend/js/components/PurchaseButton/index.spec.tsx index fc878e5d50..089d254ab2 100644 --- a/src/frontend/js/components/PurchaseButton/index.spec.tsx +++ b/src/frontend/js/components/PurchaseButton/index.spec.tsx @@ -12,7 +12,7 @@ import { CourseLightFactory, EnrollmentFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { ProductType } from 'types/Joanie'; diff --git a/src/frontend/js/components/PurchaseButton/index.stories.tsx b/src/frontend/js/components/PurchaseButton/index.stories.tsx index bf12bfdf06..e33a1f0ca0 100644 --- a/src/frontend/js/components/PurchaseButton/index.stories.tsx +++ b/src/frontend/js/components/PurchaseButton/index.stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import { ProductFactory } from 'utils/test/factories/joanie'; +import { ProductFactory } from 'utils/test/factories/joanieLegacy'; import PurchaseButton from '.'; export default { diff --git a/src/frontend/js/components/RegisteredAddress/index.spec.tsx b/src/frontend/js/components/RegisteredAddress/index.spec.tsx index b72ddbb980..fe403a7e9f 100644 --- a/src/frontend/js/components/RegisteredAddress/index.spec.tsx +++ b/src/frontend/js/components/RegisteredAddress/index.spec.tsx @@ -4,7 +4,7 @@ import { IntlProvider } from 'react-intl'; import RegisteredAddress from 'components/RegisteredAddress/index'; import type { Address } from 'types/Joanie'; import { noop } from 'utils'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; describe('RegisteredAddress', () => { const Wrapper = ({ children }: PropsWithChildren<{}>) => ( diff --git a/src/frontend/js/components/RegisteredAddress/index.stories.tsx b/src/frontend/js/components/RegisteredAddress/index.stories.tsx index 3898c6de1a..e9452ddfa7 100644 --- a/src/frontend/js/components/RegisteredAddress/index.stories.tsx +++ b/src/frontend/js/components/RegisteredAddress/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import RegisteredAddress from '.'; export default { diff --git a/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx index 5339e6cb01..6c5976bcc5 100644 --- a/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/RegisteredCreditCard/index.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, getByRole, getByText, render } from '@testing-library/react' import { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import { CreditCard } from 'types/Joanie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { RegisteredCreditCard } from '.'; describe('RegisteredCreditCard', () => { diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx index 28a567de24..6d3ddc3034 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepPayment/index.spec.tsx @@ -15,7 +15,7 @@ import { AddressFactory, CreditCardFactory, CourseLightFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { Address, CreditCard, Order, Product } from 'types/Joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx index d1d440fd45..e979651674 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepResume/index.spec.tsx @@ -4,7 +4,7 @@ import { CourseLightFactory, CredentialOrderFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { SaleTunnelContext } from 'components/SaleTunnel/context'; import { SaleTunnelStepResume } from '.'; diff --git a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx index e1db7a5244..0cc6045503 100644 --- a/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/components/SaleTunnelStepValidation/index.spec.tsx @@ -18,7 +18,7 @@ import { CourseLightFactory, CredentialProductFactory, EnrollmentFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { User } from 'types/User'; import { Maybe } from 'types/utils'; import { SaleTunnelContext, SaleTunnelContextType } from 'components/SaleTunnel/context'; diff --git a/src/frontend/js/components/SaleTunnel/index.spec.tsx b/src/frontend/js/components/SaleTunnel/index.spec.tsx index 227af33bc9..c9d1a66e41 100644 --- a/src/frontend/js/components/SaleTunnel/index.spec.tsx +++ b/src/frontend/js/components/SaleTunnel/index.spec.tsx @@ -4,7 +4,7 @@ import { Fragment } from 'react'; import { IntlProvider } from 'react-intl'; import { QueryClientProvider } from '@tanstack/react-query'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseLightFactory, ProductFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory, ProductFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import SaleTunnel from '.'; diff --git a/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx b/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx index bc8f1589ee..91667dd612 100644 --- a/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx +++ b/src/frontend/js/components/SignContractButton/index.omniscientOrders.spec.tsx @@ -5,7 +5,7 @@ import { MemoryRouter } from 'react-router-dom'; import userEvent from '@testing-library/user-event'; import { QueryClientProvider } from '@tanstack/react-query'; import fetchMock from 'fetch-mock'; -import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { useOmniscientOrders } from 'hooks/useOrders'; diff --git a/src/frontend/js/components/SignContractButton/index.spec.tsx b/src/frontend/js/components/SignContractButton/index.spec.tsx index ed2b31ea2f..865e825343 100644 --- a/src/frontend/js/components/SignContractButton/index.spec.tsx +++ b/src/frontend/js/components/SignContractButton/index.spec.tsx @@ -9,7 +9,7 @@ import { ContractFactory, CredentialOrderFactory, NestedCredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieApiProvider from 'contexts/JoanieApiContext'; diff --git a/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx b/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx index 1a25e38a55..d722cd22a5 100644 --- a/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx +++ b/src/frontend/js/components/TeacherDashboardCourseList/index.spec.tsx @@ -10,7 +10,7 @@ import { UserFactory, } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseListItemFactory } from 'utils/test/factories/joanie'; +import { CourseListItemFactory } from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; import { expectNoSpinner } from 'utils/test/expectSpinner'; diff --git a/src/frontend/js/hooks/useContractAbilities/index.spec.ts b/src/frontend/js/hooks/useContractAbilities/index.spec.ts index aa8bea7ad7..5d237291b6 100644 --- a/src/frontend/js/hooks/useContractAbilities/index.spec.ts +++ b/src/frontend/js/hooks/useContractAbilities/index.spec.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react'; import useContractAbilities from 'hooks/useContractAbilities/index'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractActions } from 'utils/AbilitiesHelper/types'; describe('useContractAbilities', () => { diff --git a/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx b/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx index 20bb064a45..b4135586dc 100644 --- a/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx +++ b/src/frontend/js/hooks/useCourseProductUnion/index.spec.tsx @@ -10,7 +10,10 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { SessionProvider } from 'contexts/SessionContext'; import { getRoutesLegacy } from 'api/joanie'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; -import { CourseListItemFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; +import { + CourseListItemFactory, + CourseProductRelationFactory, +} from 'utils/test/factories/joanieLegacy'; import { useCourseProductUnion } from '.'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/hooks/useCourses/index.spec.tsx b/src/frontend/js/hooks/useCourses/index.spec.tsx index 76e201f047..f99a5c23aa 100644 --- a/src/frontend/js/hooks/useCourses/index.spec.tsx +++ b/src/frontend/js/hooks/useCourses/index.spec.tsx @@ -8,7 +8,7 @@ import { RichieContextFactory as mockRichieContextFactory, UserFactory, } from 'utils/test/factories/richie'; -import { CourseListItemFactory } from 'utils/test/factories/joanie'; +import { CourseListItemFactory } from 'utils/test/factories/joanieLegacy'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { User } from 'types/User'; diff --git a/src/frontend/js/hooks/useCreditCards/index.spec.tsx b/src/frontend/js/hooks/useCreditCards/index.spec.tsx index 3941f56cd3..704266f298 100644 --- a/src/frontend/js/hooks/useCreditCards/index.spec.tsx +++ b/src/frontend/js/hooks/useCreditCards/index.spec.tsx @@ -4,7 +4,7 @@ import fetchMock from 'fetch-mock'; import { PropsWithChildren } from 'react'; import { act, renderHook, waitFor } from '@testing-library/react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { useCreditCard, useCreditCards } from 'hooks/useCreditCards/index'; import { SessionProvider } from 'contexts/SessionContext'; import { Deferred } from 'utils/test/deferred'; diff --git a/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx b/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx index 3c746c680c..bdb7ede73c 100644 --- a/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx +++ b/src/frontend/js/hooks/useDefaultOrganizationId/index.spec.tsx @@ -1,7 +1,7 @@ import { renderHook, waitFor } from '@testing-library/react'; import fetchMock from 'fetch-mock'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { Organization } from 'types/Joanie'; import { JoanieAppWrapper, setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; import useDefaultOrganizationId from '.'; diff --git a/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx b/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx index b0718e1ee7..cf1c8cb80b 100644 --- a/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx +++ b/src/frontend/js/hooks/useDownloadCertificate/index.spec.tsx @@ -10,7 +10,7 @@ import { handle } from 'utils/errors/handle'; import { Certificate } from 'types/Joanie'; import { SessionProvider } from 'contexts/SessionContext'; import { Deferred } from 'utils/test/deferred'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; import { HttpStatusCode } from 'utils/errors/HttpError'; jest.mock('utils/errors/handle'); diff --git a/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx b/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx index 53a4febdf6..73c05350bb 100644 --- a/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx +++ b/src/frontend/js/hooks/useJoanieUserAbilities/index.spec.tsx @@ -4,7 +4,7 @@ import { QueryClientProvider } from '@tanstack/react-query'; import { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { JoanieUserProfileFactory } from 'utils/test/factories/joanie'; +import { JoanieUserProfileFactory } from 'utils/test/factories/joanieLegacy'; import { JoanieUserApiAbilityActions } from 'types/User'; import { JoanieUserProfileActions } from 'utils/AbilitiesHelper/types'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/hooks/useProductOrder/index.spec.tsx b/src/frontend/js/hooks/useProductOrder/index.spec.tsx index 5511ffa56f..bb8f0b3e53 100644 --- a/src/frontend/js/hooks/useProductOrder/index.spec.tsx +++ b/src/frontend/js/hooks/useProductOrder/index.spec.tsx @@ -5,7 +5,7 @@ import { PropsWithChildren } from 'react'; import { act, renderHook, waitFor } from '@testing-library/react'; import { faker } from '@faker-js/faker'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseLightFactory, CredentialOrderFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory, CredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { Deferred } from 'utils/test/deferred'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx index b0d6c7719e..74c64c36e3 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardCreateAddress.spec.tsx @@ -6,7 +6,7 @@ import { IntlProvider } from 'react-intl'; import userEvent, { UserEvent } from '@testing-library/user-event'; import { PropsWithChildren } from 'react'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx index 7a3e1383fc..8c8be1909c 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.spec.tsx @@ -11,7 +11,7 @@ import { } from '@testing-library/react'; import { IntlProvider } from 'react-intl'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx index d37556dcfd..5a480f6f07 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/DashboardEditAddress.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardEditAddress } from './DashboardEditAddress'; export default { diff --git a/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx b/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx index 554b1f6c38..f57a4e006f 100644 --- a/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx +++ b/src/frontend/js/pages/DashboardAddressesManagement/index.spec.tsx @@ -12,7 +12,7 @@ import { QueryClientProvider } from '@tanstack/react-query'; import fetchMock from 'fetch-mock'; import { findByText } from '@storybook/testing-library'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardCertificates/index.spec.tsx b/src/frontend/js/pages/DashboardCertificates/index.spec.tsx index 532f59d97c..deb3668911 100644 --- a/src/frontend/js/pages/DashboardCertificates/index.spec.tsx +++ b/src/frontend/js/pages/DashboardCertificates/index.spec.tsx @@ -14,7 +14,7 @@ import { History, HistoryContext } from 'hooks/useHistory'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; import { HttpStatusCode } from 'utils/errors/HttpError'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/pages/DashboardContracts/index.spec.tsx b/src/frontend/js/pages/DashboardContracts/index.spec.tsx index b06c44cb71..d65c70f222 100644 --- a/src/frontend/js/pages/DashboardContracts/index.spec.tsx +++ b/src/frontend/js/pages/DashboardContracts/index.spec.tsx @@ -14,7 +14,7 @@ import { History, HistoryContext } from 'hooks/useHistory'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; jest.mock('utils/context', () => ({ __esModule: true, diff --git a/src/frontend/js/pages/DashboardCourses/index.spec.tsx b/src/frontend/js/pages/DashboardCourses/index.spec.tsx index 445222122a..3a122a634d 100644 --- a/src/frontend/js/pages/DashboardCourses/index.spec.tsx +++ b/src/frontend/js/pages/DashboardCourses/index.spec.tsx @@ -8,7 +8,7 @@ import { CourseProductRelationFactory, EnrollmentFactory, CredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { CourseLight, CourseProductRelation, Enrollment, CredentialOrder } from 'types/Joanie'; diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx index 90293741b1..f49c8217db 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/CreditCardBrandLogo.stories.tsx @@ -1,5 +1,5 @@ import { Meta, StoryObj } from '@storybook/react'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { CreditCard, CreditCardBrand } from 'types/Joanie'; import { CreditCardBrandLogo } from './CreditCardBrandLogo'; diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx index 01ff01b0a6..4ec1411062 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.spec.tsx @@ -11,7 +11,7 @@ import { QueryClientProvider } from '@tanstack/react-query'; import { IntlProvider } from 'react-intl'; import fetchMock from 'fetch-mock'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { SessionProvider } from 'contexts/SessionContext'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx index 58756f60ce..b73052f24e 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/DashboardEditCreditCard.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardEditCreditCard } from './DashboardEditCreditCard'; export default { diff --git a/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx b/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx index f2714e0810..c2a1468b6f 100644 --- a/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx +++ b/src/frontend/js/pages/DashboardCreditCardsManagement/index.spec.tsx @@ -13,7 +13,7 @@ import { import { IntlProvider } from 'react-intl'; import { faker } from '@faker-js/faker'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { DashboardTest } from 'widgets/Dashboard/components/DashboardTest'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; diff --git a/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx b/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx index 3b50fbd47a..e45d63a31d 100644 --- a/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx +++ b/src/frontend/js/pages/DashboardOrderLayout/index.spec.tsx @@ -4,7 +4,7 @@ import { IntlProvider } from 'react-intl'; import fetchMock from 'fetch-mock'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { CredentialOrder } from 'types/Joanie'; -import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanieLegacy'; import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx index 8c3dcd33a0..f4182646db 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/TeacherDashboardContracts/index.spec.tsx @@ -7,7 +7,7 @@ import { ContractFactory, CourseProductRelationFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { expectBannerError } from 'utils/test/expectBanner'; import { HttpStatusCode } from 'utils/errors/HttpError'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx index ab73c58bef..3a82b57d55 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/components/ContractFiltersBar/index.spec.tsx @@ -3,7 +3,7 @@ import fetchMock from 'fetch-mock'; import { userEvent } from '@testing-library/user-event'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { ContractState } from 'types/Joanie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { noop } from 'utils'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx index c3c57cc8b8..297d8736cf 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useHasContractToDownload/index.spec.tsx @@ -7,7 +7,7 @@ import { PropsWithChildren } from 'react'; import { PER_PAGE } from 'settings'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { ContractState } from 'types/Joanie'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import useHasContractToDownload from '.'; diff --git a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx index d55d20a9f7..34dc27398d 100644 --- a/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardContractsLayout/hooks/useTeacherContractFilters/index.spec.tsx @@ -8,7 +8,10 @@ import { act } from 'react-dom/test-utils'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseProductRelationFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { + CourseProductRelationFactory, + OrganizationFactory, +} from 'utils/test/factories/joanieLegacy'; import { ContractState } from 'types/Joanie'; import useTeacherContractFilters from '.'; 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 525ef6a13f..6dd41b9056 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnerDataGrid/index.spec.tsx @@ -2,7 +2,7 @@ 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 { NestedCourseOrderFactory } from 'utils/test/factories/joanie'; +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'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx index cb4bb78e12..2276ad9758 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/components/CourseLearnersFiltersBar/index.spec.tsx @@ -2,7 +2,7 @@ import { screen } from '@testing-library/react'; import { userEvent } from '@testing-library/user-event'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; import { ContractState } from 'types/Joanie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { noop } from 'utils'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; import { render } from 'utils/test/render'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx index 3abe17ddbc..e29d389894 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/hooks/useCourseLearnersFilters/index.spec.tsx @@ -2,7 +2,10 @@ import fetchMock from 'fetch-mock'; import { renderHook, waitFor } from '@testing-library/react'; import { act } from 'react-dom/test-utils'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseProductRelationFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { + CourseProductRelationFactory, + OrganizationFactory, +} from 'utils/test/factories/joanieLegacy'; import { JoanieAppWrapper, setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; import useCourseLearnersFilters from '.'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx index 6fe9b6efee..8c62460525 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLearnersLayout/index.spec.tsx @@ -7,7 +7,7 @@ import { CourseProductRelationFactory, NestedCourseOrderFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { PER_PAGE } from 'settings'; import { HttpStatusCode } from 'utils/errors/HttpError'; diff --git a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx index 616777f565..6aaaa3c470 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/index.spec.tsx @@ -3,7 +3,7 @@ import { IntlProvider } from 'react-intl'; import { CunninghamProvider } from '@openfun/cunningham-react'; import { capitalize } from 'lodash-es'; import { MemoryRouter } from 'react-router-dom'; -import { CourseRunFactory } from 'utils/test/factories/joanie'; +import { CourseRunFactory } from 'utils/test/factories/joanieLegacy'; import CourseRunList from '.'; describe('pages/TeacherDashboardCourseLoader/CourseRunList', () => { diff --git a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx index f7f6e43c25..e1468da006 100644 --- a/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCourseLoader/CourseRunList/utils.spec.tsx @@ -2,7 +2,7 @@ import { IntlProvider, createIntl } from 'react-intl'; import { render, screen } from '@testing-library/react'; import { capitalize } from 'lodash-es'; import { MemoryRouter } from 'react-router-dom'; -import { CourseRunFactory } from 'utils/test/factories/joanie'; +import { CourseRunFactory } from 'utils/test/factories/joanieLegacy'; import { buildCourseRunData, messages } from './utils'; describe('pages/TeacherDashboardCourseLoader/CourseRunList/buildCourseRunData', () => { diff --git a/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx index 1450de8304..0cdec7e6b3 100644 --- a/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardCoursesLoader/index.spec.tsx @@ -10,7 +10,10 @@ import { UserFactory, } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseListItemFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; +import { + CourseListItemFactory, + CourseProductRelationFactory, +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { mockPaginatedResponse } from 'utils/test/mockPaginatedResponse'; diff --git a/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx b/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx index 9b2ba52f16..30fe516b28 100644 --- a/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx +++ b/src/frontend/js/pages/TeacherDashboardTraining/index.spec.tsx @@ -11,7 +11,10 @@ import { UserFactory, } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { CourseProductRelationFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { + CourseProductRelationFactory, + OrganizationFactory, +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { DashboardBreadcrumbsProvider } from 'widgets/Dashboard/contexts/DashboardBreadcrumbsContext'; diff --git a/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts b/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts index ea14e5b235..98341151a7 100644 --- a/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts +++ b/src/frontend/js/utils/AbilitiesHelper/contractAbilities.spec.ts @@ -1,5 +1,5 @@ import { faker } from '@faker-js/faker'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractActions } from 'utils/AbilitiesHelper/types'; import AbilitiesHelper from '.'; diff --git a/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts b/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts index f369b6be7d..4a839efdab 100644 --- a/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts +++ b/src/frontend/js/utils/AbilitiesHelper/joanieUserProfileAbilities.spec.ts @@ -1,5 +1,5 @@ import { JoanieUserApiAbilityActions } from 'types/User'; -import { JoanieUserProfileFactory } from 'utils/test/factories/joanie'; +import { JoanieUserProfileFactory } from 'utils/test/factories/joanieLegacy'; import { JoanieUserProfileActions } from './types'; import AbilitiesHelper from '.'; diff --git a/src/frontend/js/utils/ContractHelper/index.spec.ts b/src/frontend/js/utils/ContractHelper/index.spec.ts index 46c3652eb2..50e1adbe8c 100644 --- a/src/frontend/js/utils/ContractHelper/index.spec.ts +++ b/src/frontend/js/utils/ContractHelper/index.spec.ts @@ -1,5 +1,5 @@ import { createIntl } from 'react-intl'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractState } from 'types/Joanie'; import { ContractHelper, ContractStatePoV } from '.'; diff --git a/src/frontend/js/utils/CoursesHelper/index.spec.ts b/src/frontend/js/utils/CoursesHelper/index.spec.ts index 5d3c7c5cfe..5ae641ab98 100644 --- a/src/frontend/js/utils/CoursesHelper/index.spec.ts +++ b/src/frontend/js/utils/CoursesHelper/index.spec.ts @@ -4,7 +4,7 @@ import { EnrollmentFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; describe('CourseHelper', () => { it('should find an active course enrollment in order', () => { diff --git a/src/frontend/js/utils/CreditCardHelper/index.spec.tsx b/src/frontend/js/utils/CreditCardHelper/index.spec.tsx index ce1e5849bf..f79bf07d5c 100644 --- a/src/frontend/js/utils/CreditCardHelper/index.spec.tsx +++ b/src/frontend/js/utils/CreditCardHelper/index.spec.tsx @@ -1,6 +1,6 @@ import { faker } from '@faker-js/faker'; import { CreditCardExpirationStatus, CreditCardHelper } from 'utils/CreditCardHelper/index'; -import { CreditCardFactory } from 'utils/test/factories/joanie'; +import { CreditCardFactory } from 'utils/test/factories/joanieLegacy'; describe('CreditCardHelper', () => { it('handles falsy values', () => { diff --git a/src/frontend/js/utils/ProductHelper/index.spec.ts b/src/frontend/js/utils/ProductHelper/index.spec.ts index 8ecac9ecbd..9a1a141c32 100644 --- a/src/frontend/js/utils/ProductHelper/index.spec.ts +++ b/src/frontend/js/utils/ProductHelper/index.spec.ts @@ -1,5 +1,9 @@ import { createIntl } from 'react-intl'; -import { CourseRunFactory, ProductFactory, TargetCourseFactory } from 'utils/test/factories/joanie'; +import { + CourseRunFactory, + ProductFactory, + TargetCourseFactory, +} from 'utils/test/factories/joanieLegacy'; import { ProductHelper } from '.'; describe('ProductHelper', () => { diff --git a/src/frontend/js/utils/test/factories/joanie.spec.ts b/src/frontend/js/utils/test/factories/joanieLegacy.spec.ts similarity index 78% rename from src/frontend/js/utils/test/factories/joanie.spec.ts rename to src/frontend/js/utils/test/factories/joanieLegacy.spec.ts index 671dd0dbf6..7d085e9ef1 100644 --- a/src/frontend/js/utils/test/factories/joanie.spec.ts +++ b/src/frontend/js/utils/test/factories/joanieLegacy.spec.ts @@ -1,4 +1,4 @@ -import * as joanieFactories from './joanie'; +import * as joanieFactories from './joanieLegacy'; describe('Factories joanie', () => { it.each(Object.entries(joanieFactories))('can instanciate %s', (name, Factory) => { diff --git a/src/frontend/js/utils/test/factories/joanie.ts b/src/frontend/js/utils/test/factories/joanieLegacy.ts similarity index 100% rename from src/frontend/js/utils/test/factories/joanie.ts rename to src/frontend/js/utils/test/factories/joanieLegacy.ts diff --git a/src/frontend/js/utils/test/mockCourseProductWithOrder.ts b/src/frontend/js/utils/test/mockCourseProductWithOrder.ts index 480a93381a..5130d3a905 100644 --- a/src/frontend/js/utils/test/mockCourseProductWithOrder.ts +++ b/src/frontend/js/utils/test/mockCourseProductWithOrder.ts @@ -5,7 +5,7 @@ import { CourseFactory, CourseProductRelationFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; export const mockCourseProductWithOrder = (order: CredentialOrder) => { const courseCode = order.course.code; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx index 30c2a8290b..b97e362cce 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.spec.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { JoanieFileFactory } from 'utils/test/factories/joanie'; +import { JoanieFileFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardAvatar, DashboardAvatarVariantEnum } from '.'; describe('', () => { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx index 0d1a1bfdb7..32edd847ba 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardAvatar/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { UserFactory } from 'utils/test/factories/richie'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { DashboardAvatar, DashboardAvatarVariantEnum } from '.'; export default { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx index 1c0b86dea2..83f1023612 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.spec.tsx @@ -14,7 +14,7 @@ import { CertificateFactory, NestedCertificateOrderFactory, NestedCredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { HttpStatusCode } from 'utils/errors/HttpError'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx index 08ac10e39e..9116bb5ef8 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Certificate/index.stories.tsx @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { DashboardItemCertificate } from 'widgets/Dashboard/components/DashboardItem/Certificate/index'; import { StorybookHelper } from 'utils/StorybookHelper'; import { Certificate } from 'types/Joanie'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; export default { title: 'Widgets/Dashboard/Certificate', diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx index a7953332dc..dab75602f7 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CertificateStatus/index.spec.tsx @@ -1,7 +1,7 @@ import { IntlProvider } from 'react-intl'; import { render, screen } from '@testing-library/react'; import { ProductType } from 'types/Joanie'; -import { CertificateFactory } from 'utils/test/factories/joanie'; +import { CertificateFactory } from 'utils/test/factories/joanieLegacy'; import CertificateStatus, { CertificateStatusProps } from '.'; describe('', () => { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx index 0b4f757b91..5ccba24946 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.spec.tsx @@ -15,7 +15,7 @@ import { ContractFactory, CredentialOrderFactory, NestedCredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; jest.mock('utils/context', () => ({ __esModule: true, diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx index 79b25badfc..6ab048d4c3 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Contract/index.stories.tsx @@ -2,7 +2,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { DashboardItemContract } from 'widgets/Dashboard/components/DashboardItem/Contract/index'; import { StorybookHelper } from 'utils/StorybookHelper'; import { Contract, NestedCredentialOrder } from 'types/Joanie'; -import { ContractFactory, NestedCredentialOrderFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, NestedCredentialOrderFactory } from 'utils/test/factories/joanieLegacy'; export default { title: 'Widgets/Dashboard/Contract', diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx index 02c1bb2bcd..be60444a94 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.spec.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import { IntlProvider, createIntl } from 'react-intl'; import { PropsWithChildren } from 'react'; -import { CredentialOrderFactory, EnrollmentFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, EnrollmentFactory } from 'utils/test/factories/joanieLegacy'; import { Priority } from 'types'; import { CourseRun, Enrollment } from 'types/Joanie'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx index 6d32e88967..a6abf8a089 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/CourseEnrolling/index.stories.tsx @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { createMemoryRouter, RouterProvider } from 'react-router-dom'; import { faker } from '@faker-js/faker'; -import { TargetCourseFactory } from 'utils/test/factories/joanie'; +import { TargetCourseFactory } from 'utils/test/factories/joanieLegacy'; import { StorybookHelper } from 'utils/StorybookHelper'; import { Priority } from 'types'; import { enrollment } from '../stories.mock'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx index 00b7784351..b6d99e59ac 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/DashboardItemEnrollment.spec.tsx @@ -7,7 +7,7 @@ import { CourseStateFactory, RichieContextFactory as mockRichieContextFactory, } from 'utils/test/factories/richie'; -import { CourseRunWithCourseFactory, EnrollmentFactory } from 'utils/test/factories/joanie'; +import { CourseRunWithCourseFactory, EnrollmentFactory } from 'utils/test/factories/joanieLegacy'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; import { Priority } from 'types'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx index 50c76494f1..5d89cad5ca 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Enrollment/ProductCertificateFooter/index.spec.tsx @@ -16,7 +16,7 @@ import { OrderEnrollmentFactory, EnrollmentFactory, CertificateProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { Priority } from 'types'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; @@ -35,11 +35,12 @@ jest.mock('utils/context', () => ({ joanie_backend: { endpoint: 'https://joanie.endpoint.test' }, }).one(), })); + jest.mock('components/SaleTunnel', () => ({ __esModule: true, default: ({ isOpen, onFinish }: SaleTunnelProps) => { const React = require('react'); - const Factories = require('utils/test/factories/joanie'); + const Factories = require('utils/test/factories/joanieLegacy'); // Automatically call onFinish() callback after 100ms when the SaleTunnel is opened to simulate a payment. React.useEffect(() => { if (!isOpen) { diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx index c71065794d..53ea2dd02e 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrder.spec.tsx @@ -29,7 +29,7 @@ import { EnrollmentFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { Certificate, CourseLight, CourseRun, CredentialOrder, OrderState } from 'types/Joanie'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { SessionProvider } from 'contexts/SessionContext'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx index bedadcab4e..29d3fa7ab1 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.spec.tsx @@ -13,7 +13,7 @@ import { ContractFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { expectBannerError } from 'utils/test/expectBanner'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx index e24181d098..45c2baf332 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderContract.useUnionResource.cache.spec.tsx @@ -9,7 +9,7 @@ import { ContractFactory, CredentialOrderFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { mockCourseProductWithOrder } from 'utils/test/mockCourseProductWithOrder'; import { LearnerDashboardPaths } from 'widgets/Dashboard/utils/learnerRouteMessages'; import { Deferred } from 'utils/test/deferred'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx index 9e92d12d04..01b884515d 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderReadonly.stories.tsx @@ -5,7 +5,7 @@ import { CredentialOrderFactory, ProductFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { QueryStateFactory } from 'utils/test/factories/reactQuery'; import { StorybookHelper } from 'utils/StorybookHelper'; import { enrollment } from '../stories.mock'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx index bf7c7825f3..70fffcb135 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/DashboardItemOrderWritable.stories.tsx @@ -5,7 +5,7 @@ import { CredentialOrderFactory, ProductFactory, TargetCourseFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { StorybookHelper } from 'utils/StorybookHelper'; import { enrollment } from '../stories.mock'; import { DashboardItemOrder } from './DashboardItemOrder'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx index 8af7a3e2ab..46988d5561 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateLearnerMessage/index.spec.tsx @@ -5,7 +5,7 @@ import { ContractDefinitionFactory, ContractFactory, CredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { OrderState } from 'types/Joanie'; import OrderStateLearnerMessage, { messages } from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx index af5f41f4db..9a2de6ef7d 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardItem/Order/OrderStateTeacherMessage/index.spec.tsx @@ -5,7 +5,7 @@ import { ContractDefinitionFactory, ContractFactory, CredentialOrderFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { OrderState } from 'types/Joanie'; import OrderStateTeacherMessage, { messages } from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx index 9f91c6d2be..6b3f2b58f0 100644 --- a/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/DashboardSidebar/components/ContractNavLink/index.spec.tsx @@ -11,7 +11,7 @@ import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { PER_PAGE } from 'settings'; import { ContractResourceQuery, ContractState } from 'types/Joanie'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { ContractActions } from 'utils/AbilitiesHelper/types'; import { MenuLink } from '../..'; import ContractNavLink from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx index f0712f0676..cf2053dc72 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardCourseSidebar/index.spec.tsx @@ -12,7 +12,7 @@ import { CourseFactory, CourseProductRelationFactory, OrganizationFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { expectNoSpinner } from 'utils/test/expectSpinner'; import { render } from 'utils/test/render'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx index 1400f72891..b467057384 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.spec.tsx @@ -13,7 +13,7 @@ import { } from 'utils/test/factories/richie'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; -import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { PER_PAGE } from 'settings'; import { TeacherDashboardOrganizationSidebar } from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx index 4215f3c4ff..6a028f6cb8 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardOrganizationSidebar/index.stories.tsx @@ -4,7 +4,7 @@ import fetchMock from 'fetch-mock'; import { UserFactory } from 'utils/test/factories/richie'; import { TeacherDashboardOrganizationSidebar } from 'widgets/Dashboard/components/TeacherDashboardOrganizationSidebar'; import { StorybookHelper } from 'utils/StorybookHelper'; -import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanie'; +import { ContractFactory, OrganizationFactory } from 'utils/test/factories/joanieLegacy'; export default { component: TeacherDashboardOrganizationSidebar, diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx index 1c21e62ea3..baf6111b98 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks/index.spec.tsx @@ -1,5 +1,5 @@ import { screen } from '@testing-library/react'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { render } from 'utils/test/render'; import { PresentationalAppWrapper } from 'utils/test/wrappers/PresentationalAppWrapper'; import OrganizationLinks from '.'; diff --git a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx index ba445b5dc2..3a9d338581 100644 --- a/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/components/TeacherDashboardProfileSidebar/index.spec.tsx @@ -6,7 +6,7 @@ import { TEACHER_DASHBOARD_ROUTE_LABELS, TeacherDashboardPaths, } from 'widgets/Dashboard/utils/teacherRouteMessages'; -import { OrganizationFactory } from 'utils/test/factories/joanie'; +import { OrganizationFactory } from 'utils/test/factories/joanieLegacy'; import { messages as organizationLinksMessages } from 'widgets/Dashboard/components/TeacherDashboardProfileSidebar/components/OrganizationLinks'; import { render } from 'utils/test/render'; import { setupJoanieSession } from 'utils/test/wrappers/JoanieAppWrapper'; diff --git a/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx b/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx index 3f341512f8..c476f1894e 100644 --- a/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/hooks/useEnroll/index.spec.tsx @@ -5,7 +5,7 @@ import { act, renderHook, waitFor } from '@testing-library/react'; import fetchMock from 'fetch-mock'; import { Priority } from 'types'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CourseRunFactory } from 'utils/test/factories/joanie'; +import { CourseRunFactory } from 'utils/test/factories/joanieLegacy'; import { SessionProvider } from 'contexts/SessionContext'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { useEnroll } from './index'; diff --git a/src/frontend/js/widgets/Dashboard/index.spec.tsx b/src/frontend/js/widgets/Dashboard/index.spec.tsx index ba3c3b4a5f..92afeb3eba 100644 --- a/src/frontend/js/widgets/Dashboard/index.spec.tsx +++ b/src/frontend/js/widgets/Dashboard/index.spec.tsx @@ -6,7 +6,7 @@ import { RichieContextFactory as mockRichieContextFactory, UserFactory, } from 'utils/test/factories/richie'; -import { AddressFactory } from 'utils/test/factories/joanie'; +import { AddressFactory } from 'utils/test/factories/joanieLegacy'; import { location } from 'utils/indirection/window'; import { User } from 'types/User'; import { Nullable } from 'types/utils'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx index c303eb7457..336dade107 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.spec.tsx @@ -4,7 +4,10 @@ import fetchMock from 'fetch-mock'; import { PropsWithChildren } from 'react'; import { IntlProvider } from 'react-intl'; import { RichieContextFactory as mockRichieContextFactory } from 'utils/test/factories/richie'; -import { CertificationDefinitionFactory, OrderLiteFactory } from 'utils/test/factories/joanie'; +import { + CertificationDefinitionFactory, + OrderLiteFactory, +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { CertificateDefinition, OrderLite } from 'types/Joanie'; import { HttpStatusCode } from 'utils/errors/HttpError'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx index 3b6a437e15..93590a850d 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCertificateItem/index.stories.tsx @@ -1,5 +1,8 @@ import { Meta, StoryObj } from '@storybook/react'; -import { CertificationDefinitionFactory, OrderLiteFactory } from 'utils/test/factories/joanie'; +import { + CertificationDefinitionFactory, + OrderLiteFactory, +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { StorybookHelper } from 'utils/StorybookHelper'; import CertificateItem from '.'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx index cb5f4d3956..ff1e9654a6 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseProductCourseRuns/index.spec.tsx @@ -11,7 +11,7 @@ import { EnrollmentFactory, CredentialOrderFactory, ProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import type { CourseLight, CourseRun, Enrollment } from 'types/Joanie'; import { Deferred } from 'utils/test/deferred'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx index 0c634b28d9..3c072c5379 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.spec.tsx @@ -1,6 +1,6 @@ import { faker } from '@faker-js/faker'; import { screen, getByText, render } from '@testing-library/react'; -import { CredentialOrderFactory, ProductFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, ProductFactory } from 'utils/test/factories/joanieLegacy'; import type { CourseRun, CredentialOrder } from 'types/Joanie'; import { OrderState } from 'types/Joanie'; import CourseRunItem from '.'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx index 25f279bcda..dcfd9e34da 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/components/CourseRunItem/index.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { QueryClientProvider } from '@tanstack/react-query'; -import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanie'; +import { CredentialOrderFactory, TargetCourseFactory } from 'utils/test/factories/joanieLegacy'; import { StorybookHelper } from 'utils/StorybookHelper'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { UserFactory } from 'utils/test/factories/richie'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx index 2e731ade65..4768fe2b84 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.spec.tsx @@ -13,7 +13,7 @@ import { ProductFactory, OrderGroupFullFactory, OrderGroupFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { CourseRun, diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx index 098e0f12fb..0c1c982d6b 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseProductItem/index.stories.tsx @@ -7,7 +7,7 @@ import { CourseProductRelationFactory, CredentialOrderFactory, CredentialProductFactory, -} from 'utils/test/factories/joanie'; +} from 'utils/test/factories/joanieLegacy'; import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { UserFactory } from 'utils/test/factories/richie'; import { CredentialOrder, OrderState } from 'types/Joanie'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx index b9051c4e40..dd3f9f08b7 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseRunEnrollment/index.joanie.spec.tsx @@ -5,7 +5,7 @@ import { IntlProvider } from 'react-intl'; import { faker } from '@faker-js/faker'; import { Deferred } from 'utils/test/deferred'; -import { EnrollmentFactory as JoanieEnrollment } from 'utils/test/factories/joanie'; +import { EnrollmentFactory as JoanieEnrollment } from 'utils/test/factories/joanieLegacy'; import { CourseRunFactory, RichieContextFactory as mockRichieContextFactory, diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx index 2344463a22..3b3f928fd1 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.login.spec.tsx @@ -13,7 +13,7 @@ import JoanieApiProvider from 'contexts/JoanieApiContext'; import { SessionProvider } from 'contexts/SessionContext'; import { HttpStatusCode } from 'utils/errors/HttpError'; import { CourseLight } from 'types/Joanie'; -import { CourseLightFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory } from 'utils/test/factories/joanieLegacy'; import CourseWishButton from '.'; jest.mock('utils/context', () => ({ diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx index 97217dc579..7312bd11f3 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/components/CourseWishButton/index.logout.spec.tsx @@ -12,7 +12,7 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { SessionProvider } from 'contexts/SessionContext'; import { location } from 'utils/indirection/window'; -import { CourseLightFactory } from 'utils/test/factories/joanie'; +import { CourseLightFactory } from 'utils/test/factories/joanieLegacy'; import { CourseLight } from 'types/Joanie'; import CourseWishButton from '.'; diff --git a/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx b/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx index 1c759ac281..644bf91a1a 100644 --- a/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx +++ b/src/frontend/js/widgets/SyllabusCourseRunsList/index.spec.tsx @@ -25,7 +25,10 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { CourseRun, Priority } from 'types'; import JoanieApiProvider from 'contexts/JoanieApiContext'; import { CourseProductRelation } from 'types/Joanie'; -import { CourseLightFactory, CourseProductRelationFactory } from 'utils/test/factories/joanie'; +import { + CourseLightFactory, + CourseProductRelationFactory, +} from 'utils/test/factories/joanieLegacy'; import { DEFAULT_DATE_FORMAT } from 'hooks/useDateFormat'; import { StringHelper } from 'utils/StringHelper'; import { computeStates } from 'utils/CourseRuns'; diff --git a/src/frontend/js/widgets/UserLogin/index.spec.tsx b/src/frontend/js/widgets/UserLogin/index.spec.tsx index 35aed4ee21..672bcc4914 100644 --- a/src/frontend/js/widgets/UserLogin/index.spec.tsx +++ b/src/frontend/js/widgets/UserLogin/index.spec.tsx @@ -15,7 +15,7 @@ import { createTestQueryClient } from 'utils/test/createTestQueryClient'; import { JoanieUserApiAbilityActions, User } from 'types/User'; import { HttpStatusCode } from 'utils/errors/HttpError'; import JoanieSessionProvider from 'contexts/SessionContext/JoanieSessionProvider'; -import { JoanieUserProfileFactory } from 'utils/test/factories/joanie'; +import { JoanieUserProfileFactory } from 'utils/test/factories/joanieLegacy'; import { Nullable } from 'types/utils'; import UserLogin from '.'; diff --git a/src/frontend/mocks/handlers/contracts.ts b/src/frontend/mocks/handlers/contracts.ts index 04c73e48de..636729a0f6 100644 --- a/src/frontend/mocks/handlers/contracts.ts +++ b/src/frontend/mocks/handlers/contracts.ts @@ -1,7 +1,7 @@ import { http, HttpResponse } from 'msw'; import { getAPIEndpointLegacy } from 'api/joanie'; import { Contract, PaginatedResponse } from 'types/Joanie'; -import { ContractFactory } from 'utils/test/factories/joanie'; +import { ContractFactory } from 'utils/test/factories/joanieLegacy'; import { PER_PAGE } from 'settings'; export default [