From 7a20220db5d305c8c0ec8f3d9bc5edcf4441ec19 Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Wed, 5 Jul 2023 15:10:56 +0000 Subject: [PATCH] chore: clean mocks --- src/components/Action/ActionBegin.spec.tsx | 14 +++++--------- src/components/Action/ActionCard.spec.tsx | 14 +++++--------- src/components/Action/ActionChoose.spec.tsx | 14 +++++--------- src/components/Action/ActionDone.spec.tsx | 14 +++++--------- src/components/Action/ActionList.spec.tsx | 14 +++++--------- src/components/Action/ActionModal.spec.tsx | 14 +++++--------- src/components/Action/ActionOnGoing.spec.tsx | 14 +++++--------- src/components/Action/ActionView.spec.tsx | 14 +++++--------- src/components/Analysis/AnalysisView.spec.tsx | 14 +++++--------- .../ElecHalfHourChart.spec.tsx | 14 +++++--------- .../ElecHalfHourMonthlyAnalysis.spec.tsx | 14 +++++--------- .../ElecInfoModal.spec.tsx | 14 +++++--------- .../MaxConsumptionCard/MaxConsumptionCard.spec.tsx | 14 +++++--------- src/components/Analysis/MonthlyAnalysis.spec.tsx | 14 +++++--------- .../ProfileComparator/ProfileComparator.spec.tsx | 14 +++++--------- .../ProfileComparatorRow.spec.tsx | 14 +++++--------- .../Analysis/TotalAnalysisChart/PieChart.spec.tsx | 14 +++++--------- .../TotalAnalysisChart/TotalAnalysisChart.spec.tsx | 14 +++++--------- src/components/Challenge/ChallengeCard.spec.tsx | 14 +++++--------- .../Challenge/ChallengeCardDone.spec.tsx | 14 +++++--------- .../Challenge/ChallengeCardLast.spec.tsx | 14 +++++--------- .../Challenge/ChallengeCardLocked.spec.tsx | 14 +++++--------- .../Challenge/ChallengeCardUnlocked.spec.tsx | 14 +++++--------- .../Challenge/ChallengeNoFluidModal.spec.tsx | 14 +++++--------- src/components/Challenge/ChallengeView.spec.tsx | 14 +++++--------- src/components/Charts/AxisRight.spec.tsx | 14 +++++--------- .../CommonKit/ErrorPage/ErrorPage.spec.tsx | 14 +++++--------- src/components/Connection/Connection.spec.tsx | 14 +++++--------- .../Connection/ConnectionNotFound.spec.tsx | 14 +++++--------- .../Connection/DeleteGRDFAccountModal.spec.tsx | 14 +++++--------- .../Connection/ExpiredConsentModal.spec.tsx | 14 +++++--------- .../Connection/SGEConnect/SgeConnectView.spec.tsx | 14 +++++--------- .../Connection/SGEConnect/SgeInit.spec.tsx | 14 +++++--------- .../Connection/SGEConnect/SgeModalHint.spec.tsx | 14 +++++--------- .../Connection/SGEConnect/StepAddress.spec.tsx | 14 +++++--------- .../Connection/SGEConnect/StepConsent.spec.tsx | 14 +++++--------- .../SGEConnect/StepIdentityAndPdl.spec.tsx | 14 +++++--------- .../DataloadConsumptionVisualizer.spec.tsx | 14 +++++--------- .../ConsumptionVisualizer/DataloadNoValue.spec.tsx | 14 +++++--------- .../ConsumptionVisualizer/DataloadSection.spec.tsx | 14 +++++--------- .../DataloadSectionDetail.spec.tsx | 14 +++++--------- .../DataloadSectionValue.spec.tsx | 14 +++++--------- .../EstimatedConsumptionModal.spec.tsx | 14 +++++--------- .../InfoDataConsumptionVisualizer.spec.tsx | 14 +++++--------- .../ConsumptionVisualizer/NoDataModal.spec.tsx | 14 +++++--------- .../CustomPopup/CustomPopupModal.spec.tsx | 14 +++++--------- .../DateNavigator/DateNavigator.spec.tsx | 14 +++++--------- src/components/Duel/DuelError.spec.tsx | 14 +++++--------- src/components/Duel/DuelOngoing.spec.tsx | 14 +++++--------- src/components/Duel/DuelResultModal.spec.tsx | 14 +++++--------- src/components/Duel/DuelUnlocked.spec.tsx | 14 +++++--------- src/components/Duel/DuelView.spec.tsx | 14 +++++--------- src/components/Duel/lastDuelModal.spec.tsx | 14 +++++--------- src/components/Ecogesture/EcogestureCard.spec.tsx | 14 +++++--------- .../Ecogesture/EcogestureEmptyList.spec.tsx | 14 +++++--------- .../Ecogesture/EcogestureInitModal.spec.tsx | 14 +++++--------- src/components/Ecogesture/EcogestureList.spec.tsx | 14 +++++--------- src/components/Ecogesture/EcogestureModal.spec.tsx | 14 +++++--------- .../Ecogesture/EcogestureReinitModal.spec.tsx | 14 +++++--------- src/components/Ecogesture/EcogestureView.spec.tsx | 14 +++++--------- .../Ecogesture/EfficiencyRating.spec.tsx | 14 +++++--------- .../Ecogesture/SingleEcogesture.spec.tsx | 14 +++++--------- .../EcogestureFormEquipment.spec.tsx | 14 +++++--------- .../EcogestureFormSingleChoice.spec.tsx | 14 +++++--------- .../EcogestureForm/EcogestureFormView.spec.tsx | 14 +++++--------- .../EcogestureLaunchFormModal.spec.tsx | 14 +++++--------- .../EcogestureForm/EquipmentIcon.spec.tsx | 14 +++++--------- .../EcogestureSelection.spec.tsx | 14 +++++--------- .../EcogestureSelectionDetail.spec.tsx | 14 +++++--------- .../EcogestureSelectionEnd.spec.tsx | 14 +++++--------- .../EcogestureSelectionModal.spec.tsx | 14 +++++--------- .../EcogestureSelectionRestart.spec.tsx | 14 +++++--------- .../Exploration/ExplorationError.spec.tsx | 14 +++++--------- .../Exploration/ExplorationFinished.spec.tsx | 14 +++++--------- .../Exploration/ExplorationOngoing.spec.tsx | 14 +++++--------- .../Exploration/ExplorationView.spec.tsx | 14 +++++--------- src/components/Export/exportDoneModal.spec.tsx | 14 +++++--------- src/components/Export/exportLoadingModal.spec.tsx | 14 +++++--------- src/components/Export/exportStartModal.spec.tsx | 14 +++++--------- src/components/Feedback/FeedbackModal.spec.tsx | 14 +++++--------- src/components/FormGlobal/FormNavigation.spec.tsx | 14 +++++--------- .../HalfHourNoData/HalfHourNoData.spec.tsx | 14 +++++--------- src/components/Header/CozyBar.spec.tsx | 14 +++++--------- src/components/Header/Header.spec.tsx | 14 +++++--------- src/components/Home/ConsumptionDetails.spec.tsx | 14 +++++--------- src/components/Home/ConsumptionView.spec.tsx | 14 +++++--------- src/components/Home/FluidButton.spec.tsx | 14 +++++--------- src/components/Home/FluidButtons.spec.tsx | 14 +++++--------- src/components/Konnector/KonnectorModal.spec.tsx | 14 +++++--------- .../Konnector/KonnectorModalFooter.spec.tsx | 14 +++++--------- .../Konnector/KonnectorViewerList.spec.tsx | 14 +++++--------- src/components/Loader/Loader.spec.tsx | 14 +++++--------- src/components/Navbar/Navbar.spec.tsx | 14 +++++--------- .../Options/ExportData/ExportData.spec.tsx | 14 +++++--------- src/components/Options/GCU/GCULink.spec.tsx | 14 +++++--------- .../LegalNotice/LegalNoticeContent.spec.tsx | 14 +++++--------- .../Options/LegalNotice/LegalNoticeLink.spec.tsx | 14 +++++--------- .../Options/MatomoOptOut/MatomoOptOut.spec.tsx | 14 +++++--------- .../ProfileTypeOptions/ProfileTypeOptions.spec.tsx | 14 +++++--------- .../Options/ReportOptions/ReportOptions.spec.tsx | 14 +++++--------- .../Options/Unsubscribe/UnSubscribe.spec.tsx | 14 +++++--------- .../PartnerIssue/PartnerIssueModal.spec.tsx | 14 +++++--------- .../ProfileType/ProfileTypeFinished.spec.tsx | 14 +++++--------- .../ProfileTypeFormMultiChoice.spec.tsx | 14 +++++--------- .../ProfileType/ProfileTypeFormNumber.spec.tsx | 14 +++++--------- .../ProfileTypeFormNumberSelection.spec.tsx | 14 +++++--------- .../ProfileTypeFormSingleChoice.spec.tsx | 14 +++++--------- .../ProfileType/ProfileTypeView.spec.tsx | 14 +++++--------- src/components/Quiz/QuizBegin.spec.tsx | 14 +++++--------- .../Quiz/QuizCustomQuestionContent.spec.tsx | 14 +++++--------- src/components/Quiz/QuizFinish.spec.tsx | 14 +++++--------- src/components/Quiz/QuizQuestion.spec.tsx | 14 +++++--------- src/components/Quiz/QuizQuestionContent.spec.tsx | 14 +++++--------- src/components/Quiz/QuizView.spec.tsx | 14 +++++--------- src/components/Splash/SplashRoot.spec.tsx | 14 +++++--------- src/components/Splash/SplashScreen.spec.tsx | 14 +++++--------- src/components/Splash/SplashScreenError.spec.tsx | 14 +++++--------- src/components/Terms/CGUModal.spec.tsx | 14 +++++--------- .../Terms/DataShareConsentContent.spec.tsx | 14 +++++--------- src/components/Terms/LegalNoticeModal.spec.tsx | 14 +++++--------- src/components/Terms/MinorUpdateContent.spec.tsx | 14 +++++--------- src/components/Terms/TermsView.spec.tsx | 14 +++++--------- .../TimeStepSelector/TimeStepSelector.spec.tsx | 14 +++++--------- .../TotalConsumption/TotalConsumption.spec.tsx | 14 +++++--------- src/components/WelcomeModal/WelcomeModal.spec.tsx | 14 +++++--------- src/store/chart/chart.slice.spec.ts | 2 +- src/store/profileType/profileType.slice.spec.ts | 2 +- 127 files changed, 627 insertions(+), 1127 deletions(-) diff --git a/src/components/Action/ActionBegin.spec.tsx b/src/components/Action/ActionBegin.spec.tsx index a1a87fe0f..cdc6b00e9 100644 --- a/src/components/Action/ActionBegin.spec.tsx +++ b/src/components/Action/ActionBegin.spec.tsx @@ -18,15 +18,11 @@ import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mo import ActionBegin from './ActionBegin' import ActionModal from './ActionModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockgetCustomActions = jest.fn() const mockgetDefaultActions = jest.fn() diff --git a/src/components/Action/ActionCard.spec.tsx b/src/components/Action/ActionCard.spec.tsx index cfd33fede..b859485d9 100644 --- a/src/components/Action/ActionCard.spec.tsx +++ b/src/components/Action/ActionCard.spec.tsx @@ -11,15 +11,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import ActionCard from './ActionCard' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn(() => defaultIcon) jest.mock('utils/utils', () => { diff --git a/src/components/Action/ActionChoose.spec.tsx b/src/components/Action/ActionChoose.spec.tsx index 147ac73cb..5964cac6e 100644 --- a/src/components/Action/ActionChoose.spec.tsx +++ b/src/components/Action/ActionChoose.spec.tsx @@ -12,15 +12,11 @@ import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mo import ActionBegin from './ActionBegin' import ActionChoose from './ActionChoose' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockGetEcogesturesByIds = jest.fn(() => []) jest.mock('services/ecogesture.service', () => { diff --git a/src/components/Action/ActionDone.spec.tsx b/src/components/Action/ActionDone.spec.tsx index d0ef0648a..8cd504e7c 100644 --- a/src/components/Action/ActionDone.spec.tsx +++ b/src/components/Action/ActionDone.spec.tsx @@ -11,15 +11,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import ActionDone from './ActionDone' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('services/usageEvent.service') const mockAddEvent = jest.fn() UsageEventService.addEvent = mockAddEvent diff --git a/src/components/Action/ActionList.spec.tsx b/src/components/Action/ActionList.spec.tsx index 358a734bb..3da60b479 100644 --- a/src/components/Action/ActionList.spec.tsx +++ b/src/components/Action/ActionList.spec.tsx @@ -22,15 +22,11 @@ jest.mock('services/action.service', () => { }) }) -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('ActionList component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Action/ActionModal.spec.tsx b/src/components/Action/ActionModal.spec.tsx index 63083f90b..153acd6fa 100644 --- a/src/components/Action/ActionModal.spec.tsx +++ b/src/components/Action/ActionModal.spec.tsx @@ -12,15 +12,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import ActionModal from './ActionModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockupdateUserChallenge = jest.fn() jest.mock('services/challenge.service', () => { return jest.fn(() => { diff --git a/src/components/Action/ActionOnGoing.spec.tsx b/src/components/Action/ActionOnGoing.spec.tsx index 06a4e5d78..e4d9d1be1 100644 --- a/src/components/Action/ActionOnGoing.spec.tsx +++ b/src/components/Action/ActionOnGoing.spec.tsx @@ -12,15 +12,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import ActionOnGoing from './ActionOnGoing' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() jest.mock('utils/utils', () => { return { diff --git a/src/components/Action/ActionView.spec.tsx b/src/components/Action/ActionView.spec.tsx index 710e0fbd3..be9251b14 100644 --- a/src/components/Action/ActionView.spec.tsx +++ b/src/components/Action/ActionView.spec.tsx @@ -11,15 +11,11 @@ import ActionChoose from './ActionChoose' import ActionDone from './ActionDone' import ActionOnGoing from './ActionOnGoing' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Analysis/AnalysisView.spec.tsx b/src/components/Analysis/AnalysisView.spec.tsx index f676bedb7..9e8e469ea 100644 --- a/src/components/Analysis/AnalysisView.spec.tsx +++ b/src/components/Analysis/AnalysisView.spec.tsx @@ -12,15 +12,11 @@ import { mockProfileState, } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/Header/CozyBar', () => 'mock-cozybar') jest.mock('components/Header/Header', () => 'mock-header') jest.mock('components/Content/Content', () => 'mock-content') diff --git a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourChart.spec.tsx b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourChart.spec.tsx index 44006e40b..fd5718d40 100644 --- a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourChart.spec.tsx +++ b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourChart.spec.tsx @@ -7,15 +7,11 @@ import { dataLoadArray } from '../../../../tests/__mocks__/chartData.mock' import { createMockEcolyoStore } from '../../../../tests/__mocks__/store' import ElecHalfHourChart from './ElecHalfHourChart' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('services/dateChart.service', () => { return jest.fn(() => { return { diff --git a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourMonthlyAnalysis.spec.tsx b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourMonthlyAnalysis.spec.tsx index cf7a593ee..ca9c022fe 100644 --- a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourMonthlyAnalysis.spec.tsx +++ b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecHalfHourMonthlyAnalysis.spec.tsx @@ -13,15 +13,11 @@ import { createMockEcolyoStore } from '../../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../../tests/__mocks__/testUtils' import ElecHalfHourMonthlyAnalysis from './ElecHalfHourMonthlyAnalysis' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/Hooks/useExploration', () => { return () => ['', jest.fn()] }) diff --git a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecInfoModal.spec.tsx b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecInfoModal.spec.tsx index a3207082f..7dba81723 100644 --- a/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecInfoModal.spec.tsx +++ b/src/components/Analysis/ElecHalfHourMonthlyAnalysis/ElecInfoModal.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import ElecInfoModal from './ElecInfoModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('ElecInfoModal component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Analysis/MaxConsumptionCard/MaxConsumptionCard.spec.tsx b/src/components/Analysis/MaxConsumptionCard/MaxConsumptionCard.spec.tsx index d6cfe69bb..d1ef094ee 100644 --- a/src/components/Analysis/MaxConsumptionCard/MaxConsumptionCard.spec.tsx +++ b/src/components/Analysis/MaxConsumptionCard/MaxConsumptionCard.spec.tsx @@ -9,15 +9,11 @@ import { createMockEcolyoStore } from '../../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../../tests/__mocks__/testUtils' import MaxConsumptionCard from './MaxConsumptionCard' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockGetMaxLoad = jest.fn(() => 0) const mockGetGraphData = jest.fn(() => graphData) diff --git a/src/components/Analysis/MonthlyAnalysis.spec.tsx b/src/components/Analysis/MonthlyAnalysis.spec.tsx index eee85b61c..5168b4c45 100644 --- a/src/components/Analysis/MonthlyAnalysis.spec.tsx +++ b/src/components/Analysis/MonthlyAnalysis.spec.tsx @@ -9,15 +9,11 @@ import mockClient from '../../../tests/__mocks__/client' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('cozy-client', () => ({ useClient: () => mockClient, diff --git a/src/components/Analysis/ProfileComparator/ProfileComparator.spec.tsx b/src/components/Analysis/ProfileComparator/ProfileComparator.spec.tsx index d67215220..ca8ee2671 100644 --- a/src/components/Analysis/ProfileComparator/ProfileComparator.spec.tsx +++ b/src/components/Analysis/ProfileComparator/ProfileComparator.spec.tsx @@ -18,15 +18,11 @@ import { import { waitForComponentToPaint } from '../../../../tests/__mocks__/testUtils' import ProfileComparator from './ProfileComparator' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Analysis/ProfileComparator/ProfileComparatorRow.spec.tsx b/src/components/Analysis/ProfileComparator/ProfileComparatorRow.spec.tsx index 6691932a7..07a0f8096 100644 --- a/src/components/Analysis/ProfileComparator/ProfileComparatorRow.spec.tsx +++ b/src/components/Analysis/ProfileComparator/ProfileComparatorRow.spec.tsx @@ -5,15 +5,11 @@ import React from 'react' import { mockMonthlyForecastJanuaryTestProfile1 } from '../../../../tests/__mocks__/profileType.mock' import ProfileComparatorRow from './ProfileComparatorRow' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('AnalysisConsumptionRow component', () => { const userPriceConsumption = 20 diff --git a/src/components/Analysis/TotalAnalysisChart/PieChart.spec.tsx b/src/components/Analysis/TotalAnalysisChart/PieChart.spec.tsx index 58a58e09b..1586ba71b 100644 --- a/src/components/Analysis/TotalAnalysisChart/PieChart.spec.tsx +++ b/src/components/Analysis/TotalAnalysisChart/PieChart.spec.tsx @@ -5,15 +5,11 @@ import { DataloadValueDetail } from 'models' import React from 'react' import PieChart from './PieChart' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('PieChart component', () => { const mockDataloadValueDetailArray: DataloadValueDetail[] = [ diff --git a/src/components/Analysis/TotalAnalysisChart/TotalAnalysisChart.spec.tsx b/src/components/Analysis/TotalAnalysisChart/TotalAnalysisChart.spec.tsx index bfef8f1ca..c3b08b9ea 100644 --- a/src/components/Analysis/TotalAnalysisChart/TotalAnalysisChart.spec.tsx +++ b/src/components/Analysis/TotalAnalysisChart/TotalAnalysisChart.spec.tsx @@ -11,15 +11,11 @@ import { createMockEcolyoStore } from '../../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../../tests/__mocks__/testUtils' import TotalAnalysisChart from './TotalAnalysisChart' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockGetGraphData = jest.fn() jest.mock('services/consumption.service', () => { return jest.fn(() => ({ diff --git a/src/components/Challenge/ChallengeCard.spec.tsx b/src/components/Challenge/ChallengeCard.spec.tsx index 9519e7e99..8cd8bbc49 100644 --- a/src/components/Challenge/ChallengeCard.spec.tsx +++ b/src/components/Challenge/ChallengeCard.spec.tsx @@ -6,15 +6,11 @@ import ChallengeCardLocked from './ChallengeCardLocked' import ChallengeCardOnGoing from './ChallengeCardOnGoing' import ChallengeCardUnlocked from './ChallengeCardUnlocked' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockMoveToSlide = jest.fn() diff --git a/src/components/Challenge/ChallengeCardDone.spec.tsx b/src/components/Challenge/ChallengeCardDone.spec.tsx index e447ca39f..07371a118 100644 --- a/src/components/Challenge/ChallengeCardDone.spec.tsx +++ b/src/components/Challenge/ChallengeCardDone.spec.tsx @@ -3,15 +3,11 @@ import { shallow } from 'enzyme' import React from 'react' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() const mockFormatNumberValues = jest.fn() jest.mock('utils/utils', () => { diff --git a/src/components/Challenge/ChallengeCardLast.spec.tsx b/src/components/Challenge/ChallengeCardLast.spec.tsx index 2f24464a8..027b0268a 100644 --- a/src/components/Challenge/ChallengeCardLast.spec.tsx +++ b/src/components/Challenge/ChallengeCardLast.spec.tsx @@ -6,15 +6,11 @@ import ChallengeCardLast from './ChallengeCardLast' // Value coming from jest.config declare let __SAU_IDEA_DIRECT_LINK__: string -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('ChallengeCardLast component', () => { it('should be rendered correctly', async () => { diff --git a/src/components/Challenge/ChallengeCardLocked.spec.tsx b/src/components/Challenge/ChallengeCardLocked.spec.tsx index e1a908384..ca7f554f9 100644 --- a/src/components/Challenge/ChallengeCardLocked.spec.tsx +++ b/src/components/Challenge/ChallengeCardLocked.spec.tsx @@ -3,15 +3,11 @@ import React from 'react' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import ChallengeCardLocked from './ChallengeCardLocked' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('ChallengeCardLocked component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Challenge/ChallengeCardUnlocked.spec.tsx b/src/components/Challenge/ChallengeCardUnlocked.spec.tsx index 470b80932..13cb72235 100644 --- a/src/components/Challenge/ChallengeCardUnlocked.spec.tsx +++ b/src/components/Challenge/ChallengeCardUnlocked.spec.tsx @@ -12,15 +12,11 @@ import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mo import ChallengeCardUnlocked from './ChallengeCardUnlocked' import ChallengeNoFluidModal from './ChallengeNoFluidModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockStartUserChallenge = jest.fn() jest.mock('services/challenge.service', () => { diff --git a/src/components/Challenge/ChallengeNoFluidModal.spec.tsx b/src/components/Challenge/ChallengeNoFluidModal.spec.tsx index 8e92291ea..e223c20f9 100644 --- a/src/components/Challenge/ChallengeNoFluidModal.spec.tsx +++ b/src/components/Challenge/ChallengeNoFluidModal.spec.tsx @@ -2,15 +2,11 @@ import { shallow } from 'enzyme' import React from 'react' import ChallengeNoFluidModal from './ChallengeNoFluidModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('ChallengeNoFluidModal component', () => { it('should be rendered correctly opened', () => { diff --git a/src/components/Challenge/ChallengeView.spec.tsx b/src/components/Challenge/ChallengeView.spec.tsx index 63095bbce..d8eee4929 100644 --- a/src/components/Challenge/ChallengeView.spec.tsx +++ b/src/components/Challenge/ChallengeView.spec.tsx @@ -6,15 +6,11 @@ import * as reactRedux from 'react-redux' import { challengeStateDataFull } from '../../../tests/__mocks__/challengeStateData.mock' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/Header/CozyBar', () => 'mock-cozybar') jest.mock('components/Header/Header', () => 'mock-header') diff --git a/src/components/Charts/AxisRight.spec.tsx b/src/components/Charts/AxisRight.spec.tsx index 668eb4e85..66f7230e2 100644 --- a/src/components/Charts/AxisRight.spec.tsx +++ b/src/components/Charts/AxisRight.spec.tsx @@ -4,15 +4,11 @@ import { mount } from 'enzyme' import React from 'react' import AxisRight from './AxisRight' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockProps = { yScale: scaleLinear(), diff --git a/src/components/CommonKit/ErrorPage/ErrorPage.spec.tsx b/src/components/CommonKit/ErrorPage/ErrorPage.spec.tsx index a8ae27035..685b0f43c 100644 --- a/src/components/CommonKit/ErrorPage/ErrorPage.spec.tsx +++ b/src/components/CommonKit/ErrorPage/ErrorPage.spec.tsx @@ -5,15 +5,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import ErrorPage from './ErrorPage' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Connection/Connection.spec.tsx b/src/components/Connection/Connection.spec.tsx index c44b0d8d9..05bc2fcbb 100644 --- a/src/components/Connection/Connection.spec.tsx +++ b/src/components/Connection/Connection.spec.tsx @@ -19,15 +19,11 @@ jest.mock('components/Connection/GRDFConnect/GrdfInit', () => { }) }) -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Connection/ConnectionNotFound.spec.tsx b/src/components/Connection/ConnectionNotFound.spec.tsx index 1772e89ff..f0df05f18 100644 --- a/src/components/Connection/ConnectionNotFound.spec.tsx +++ b/src/components/Connection/ConnectionNotFound.spec.tsx @@ -3,15 +3,11 @@ import ConnectionNotFound from 'components/Connection/ConnectionNotFound' import { mount, shallow } from 'enzyme' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('ConnectionNotFound component test', () => { const konnectorSlug = 'enedissgegrandlyon' diff --git a/src/components/Connection/DeleteGRDFAccountModal.spec.tsx b/src/components/Connection/DeleteGRDFAccountModal.spec.tsx index 9450e052f..93cea948d 100644 --- a/src/components/Connection/DeleteGRDFAccountModal.spec.tsx +++ b/src/components/Connection/DeleteGRDFAccountModal.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import DeleteGRDFAccountModal from './DeleteGRDFAccountModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('DeleteGRDFAccountModal component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Connection/ExpiredConsentModal.spec.tsx b/src/components/Connection/ExpiredConsentModal.spec.tsx index a7f2adf28..a6f9f8fd4 100644 --- a/src/components/Connection/ExpiredConsentModal.spec.tsx +++ b/src/components/Connection/ExpiredConsentModal.spec.tsx @@ -9,15 +9,11 @@ import { fluidStatusConnectedData } from '../../../tests/__mocks__/fluidStatusDa import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import ExpiredConsentModal from './ExpiredConsentModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Connection/SGEConnect/SgeConnectView.spec.tsx b/src/components/Connection/SGEConnect/SgeConnectView.spec.tsx index 8cdce7697..a65895112 100644 --- a/src/components/Connection/SGEConnect/SgeConnectView.spec.tsx +++ b/src/components/Connection/SGEConnect/SgeConnectView.spec.tsx @@ -10,15 +10,11 @@ import { } from '../../../../tests/__mocks__/store' import SgeConnectView from './SgeConnectView' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Connection/SGEConnect/SgeInit.spec.tsx b/src/components/Connection/SGEConnect/SgeInit.spec.tsx index 724b24741..e2e28ffb3 100644 --- a/src/components/Connection/SGEConnect/SgeInit.spec.tsx +++ b/src/components/Connection/SGEConnect/SgeInit.spec.tsx @@ -14,15 +14,11 @@ import { import { waitForComponentToPaint } from '../../../../tests/__mocks__/testUtils' import SgeInit from './SgeInit' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Connection/SGEConnect/SgeModalHint.spec.tsx b/src/components/Connection/SGEConnect/SgeModalHint.spec.tsx index 04512dcf3..b4099e1f6 100644 --- a/src/components/Connection/SGEConnect/SgeModalHint.spec.tsx +++ b/src/components/Connection/SGEConnect/SgeModalHint.spec.tsx @@ -5,15 +5,11 @@ import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../../tests/__mocks__/store' import SgeModalHint from './SgeModalHint' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('SgeModalHint component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Connection/SGEConnect/StepAddress.spec.tsx b/src/components/Connection/SGEConnect/StepAddress.spec.tsx index 9bc479799..9cc71083d 100644 --- a/src/components/Connection/SGEConnect/StepAddress.spec.tsx +++ b/src/components/Connection/SGEConnect/StepAddress.spec.tsx @@ -8,15 +8,11 @@ import { } from '../../../../tests/__mocks__/store' import StepAddress from './StepAddress' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleChange = jest.fn() describe('StepAddress component', () => { diff --git a/src/components/Connection/SGEConnect/StepConsent.spec.tsx b/src/components/Connection/SGEConnect/StepConsent.spec.tsx index 451ac3785..392b56f33 100644 --- a/src/components/Connection/SGEConnect/StepConsent.spec.tsx +++ b/src/components/Connection/SGEConnect/StepConsent.spec.tsx @@ -8,15 +8,11 @@ import { } from '../../../../tests/__mocks__/store' import StepConsent from './StepConsent' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleChange = jest.fn() describe('StepConsent component', () => { diff --git a/src/components/Connection/SGEConnect/StepIdentityAndPdl.spec.tsx b/src/components/Connection/SGEConnect/StepIdentityAndPdl.spec.tsx index 34860ce4b..722ba9054 100644 --- a/src/components/Connection/SGEConnect/StepIdentityAndPdl.spec.tsx +++ b/src/components/Connection/SGEConnect/StepIdentityAndPdl.spec.tsx @@ -8,15 +8,11 @@ import { } from '../../../../tests/__mocks__/store' import StepIdentityAndPdl from './StepIdentityAndPdl' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleChange = jest.fn() describe('StepIdentityAndPdl component', () => { diff --git a/src/components/ConsumptionVisualizer/DataloadConsumptionVisualizer.spec.tsx b/src/components/ConsumptionVisualizer/DataloadConsumptionVisualizer.spec.tsx index 775c015bb..f3ae34bb9 100644 --- a/src/components/ConsumptionVisualizer/DataloadConsumptionVisualizer.spec.tsx +++ b/src/components/ConsumptionVisualizer/DataloadConsumptionVisualizer.spec.tsx @@ -15,15 +15,11 @@ import { import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import DataloadConsumptionVisualizer from './DataloadConsumptionVisualizer' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockGetAllLastPrices = jest.fn() jest.mock('services/fluidsPrices.service', () => { diff --git a/src/components/ConsumptionVisualizer/DataloadNoValue.spec.tsx b/src/components/ConsumptionVisualizer/DataloadNoValue.spec.tsx index 8dff84828..2c35790bc 100644 --- a/src/components/ConsumptionVisualizer/DataloadNoValue.spec.tsx +++ b/src/components/ConsumptionVisualizer/DataloadNoValue.spec.tsx @@ -7,15 +7,11 @@ import React from 'react' import { baseDataLoad } from '../../../tests/__mocks__/chartData.mock' import DataloadNoValue from './DataloadNoValue' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockSetActive = jest.fn() describe('DataloadNoValue component', () => { diff --git a/src/components/ConsumptionVisualizer/DataloadSection.spec.tsx b/src/components/ConsumptionVisualizer/DataloadSection.spec.tsx index 32f5bea21..ebfbc8f31 100644 --- a/src/components/ConsumptionVisualizer/DataloadSection.spec.tsx +++ b/src/components/ConsumptionVisualizer/DataloadSection.spec.tsx @@ -7,15 +7,11 @@ import React from 'react' import { baseDataLoad } from '../../../tests/__mocks__/chartData.mock' import DataloadSection from './DataloadSection' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock( 'components/ConsumptionVisualizer/DataloadSectionValue', diff --git a/src/components/ConsumptionVisualizer/DataloadSectionDetail.spec.tsx b/src/components/ConsumptionVisualizer/DataloadSectionDetail.spec.tsx index 677ebe1a5..25a3ae337 100644 --- a/src/components/ConsumptionVisualizer/DataloadSectionDetail.spec.tsx +++ b/src/components/ConsumptionVisualizer/DataloadSectionDetail.spec.tsx @@ -7,15 +7,11 @@ import React from 'react' import { baseDataLoad } from '../../../tests/__mocks__/chartData.mock' import DataloadSectionDetail from './DataloadSectionDetail' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('DataloadSectionDetail component', () => { const mockDataload: Dataload = baseDataLoad diff --git a/src/components/ConsumptionVisualizer/DataloadSectionValue.spec.tsx b/src/components/ConsumptionVisualizer/DataloadSectionValue.spec.tsx index 1604ac509..58b511e70 100644 --- a/src/components/ConsumptionVisualizer/DataloadSectionValue.spec.tsx +++ b/src/components/ConsumptionVisualizer/DataloadSectionValue.spec.tsx @@ -10,15 +10,11 @@ import { } from '../../../tests/__mocks__/chartData.mock' import DataloadSectionValue from './DataloadSectionValue' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockToggleEstimationModal = jest.fn() diff --git a/src/components/ConsumptionVisualizer/EstimatedConsumptionModal.spec.tsx b/src/components/ConsumptionVisualizer/EstimatedConsumptionModal.spec.tsx index 4409bb8b4..250e959f5 100644 --- a/src/components/ConsumptionVisualizer/EstimatedConsumptionModal.spec.tsx +++ b/src/components/ConsumptionVisualizer/EstimatedConsumptionModal.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EstimatedConsumptionModal from './EstimatedConsumptionModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockGetAllLastPrices = jest.fn() jest.mock('services/fluidsPrices.service', () => { diff --git a/src/components/ConsumptionVisualizer/InfoDataConsumptionVisualizer.spec.tsx b/src/components/ConsumptionVisualizer/InfoDataConsumptionVisualizer.spec.tsx index 37aa7ad42..0de0cb23c 100644 --- a/src/components/ConsumptionVisualizer/InfoDataConsumptionVisualizer.spec.tsx +++ b/src/components/ConsumptionVisualizer/InfoDataConsumptionVisualizer.spec.tsx @@ -12,15 +12,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import InfoDataConsumptionVisualizer from './InfoDataConsumptionVisualizer' import NoDataModal from './NoDataModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUseDispatch = jest.spyOn(reactRedux, 'useDispatch') diff --git a/src/components/ConsumptionVisualizer/NoDataModal.spec.tsx b/src/components/ConsumptionVisualizer/NoDataModal.spec.tsx index 4b8d40505..44fa9239f 100644 --- a/src/components/ConsumptionVisualizer/NoDataModal.spec.tsx +++ b/src/components/ConsumptionVisualizer/NoDataModal.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import NoDataModal from './NoDataModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('NoDataModal component', () => { it('should render correctly', async () => { diff --git a/src/components/CustomPopup/CustomPopupModal.spec.tsx b/src/components/CustomPopup/CustomPopupModal.spec.tsx index 845c8722c..9b7c41f59 100644 --- a/src/components/CustomPopup/CustomPopupModal.spec.tsx +++ b/src/components/CustomPopup/CustomPopupModal.spec.tsx @@ -9,15 +9,11 @@ import { } from '../../../tests/__mocks__/customPopup.mock' import CustomPopupModal from './CustomPopupModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() diff --git a/src/components/DateNavigator/DateNavigator.spec.tsx b/src/components/DateNavigator/DateNavigator.spec.tsx index 741a4f4a4..8c6691f72 100644 --- a/src/components/DateNavigator/DateNavigator.spec.tsx +++ b/src/components/DateNavigator/DateNavigator.spec.tsx @@ -7,15 +7,11 @@ import React from 'react' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import DateNavigator from './DateNavigator' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock( 'components/DateNavigator/DateNavigatorFormat', diff --git a/src/components/Duel/DuelError.spec.tsx b/src/components/Duel/DuelError.spec.tsx index 1e7314f24..775b744bb 100644 --- a/src/components/Duel/DuelError.spec.tsx +++ b/src/components/Duel/DuelError.spec.tsx @@ -2,15 +2,11 @@ import DuelError from 'components/Duel/DuelError' import { shallow } from 'enzyme' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Duel/DuelOngoing.spec.tsx b/src/components/Duel/DuelOngoing.spec.tsx index 3a8c92a30..10cacec7d 100644 --- a/src/components/Duel/DuelOngoing.spec.tsx +++ b/src/components/Duel/DuelOngoing.spec.tsx @@ -10,15 +10,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import DuelResultModal from './DuelResultModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUserChallengeUpdateFlag = jest.fn() const mockIsChallengeDone = jest.fn() diff --git a/src/components/Duel/DuelResultModal.spec.tsx b/src/components/Duel/DuelResultModal.spec.tsx index 2025ed96b..c3ba0cf22 100644 --- a/src/components/Duel/DuelResultModal.spec.tsx +++ b/src/components/Duel/DuelResultModal.spec.tsx @@ -5,15 +5,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import DuelResultModal from './DuelResultModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() const mockFormatNumberValues = jest.fn() jest.mock('utils/utils', () => { diff --git a/src/components/Duel/DuelUnlocked.spec.tsx b/src/components/Duel/DuelUnlocked.spec.tsx index 3fa783215..ebe4ee5c9 100644 --- a/src/components/Duel/DuelUnlocked.spec.tsx +++ b/src/components/Duel/DuelUnlocked.spec.tsx @@ -15,15 +15,11 @@ import { } from '../../../tests/__mocks__/store' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn(() => defaultIcon) const mockFormatNumberValues = jest.fn() jest.mock('utils/utils', () => { diff --git a/src/components/Duel/DuelView.spec.tsx b/src/components/Duel/DuelView.spec.tsx index aa1c26362..2c6a3e193 100644 --- a/src/components/Duel/DuelView.spec.tsx +++ b/src/components/Duel/DuelView.spec.tsx @@ -26,15 +26,11 @@ jest.mock('react-router-dom', () => ({ useNavigate: () => mockedNavigate, })) -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('DuelView component', () => { it('should be rendered with DuelError component when no current challenge', () => { diff --git a/src/components/Duel/lastDuelModal.spec.tsx b/src/components/Duel/lastDuelModal.spec.tsx index f0b613baf..e907ad576 100644 --- a/src/components/Duel/lastDuelModal.spec.tsx +++ b/src/components/Duel/lastDuelModal.spec.tsx @@ -4,15 +4,11 @@ import React from 'react' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import LastDuelModal from './lastDuelModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('lastDuelModal component', () => { it('should render correctly', async () => { diff --git a/src/components/Ecogesture/EcogestureCard.spec.tsx b/src/components/Ecogesture/EcogestureCard.spec.tsx index b27adc651..b5e1b476f 100644 --- a/src/components/Ecogesture/EcogestureCard.spec.tsx +++ b/src/components/Ecogesture/EcogestureCard.spec.tsx @@ -7,15 +7,11 @@ import { BrowserRouter } from 'react-router-dom' import { mockedEcogesturesData } from '../../../tests/__mocks__/ecogesturesData.mock' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/CommonKit/Icon/StyledIcon', () => () => ( <div id="StyledIcon" /> )) diff --git a/src/components/Ecogesture/EcogestureEmptyList.spec.tsx b/src/components/Ecogesture/EcogestureEmptyList.spec.tsx index 41980af0f..e6d11ab23 100644 --- a/src/components/Ecogesture/EcogestureEmptyList.spec.tsx +++ b/src/components/Ecogesture/EcogestureEmptyList.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureEmptyList from './EcogestureEmptyList' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useNavigate: () => mockedNavigate, diff --git a/src/components/Ecogesture/EcogestureInitModal.spec.tsx b/src/components/Ecogesture/EcogestureInitModal.spec.tsx index a3e1543ac..47c4af897 100644 --- a/src/components/Ecogesture/EcogestureInitModal.spec.tsx +++ b/src/components/Ecogesture/EcogestureInitModal.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureInitModal from './EcogestureInitModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() jest.mock('utils/utils', () => { return { diff --git a/src/components/Ecogesture/EcogestureList.spec.tsx b/src/components/Ecogesture/EcogestureList.spec.tsx index 0e14bb67e..21d10a3a5 100644 --- a/src/components/Ecogesture/EcogestureList.spec.tsx +++ b/src/components/Ecogesture/EcogestureList.spec.tsx @@ -7,15 +7,11 @@ import { BrowserRouter } from 'react-router-dom' import { mockedEcogesturesData } from '../../../tests/__mocks__/ecogesturesData.mock' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/Ecogesture/EcogestureCard', () => 'mock-ecogesturecard') const mockHandleReinit = jest.fn() diff --git a/src/components/Ecogesture/EcogestureModal.spec.tsx b/src/components/Ecogesture/EcogestureModal.spec.tsx index fb3cf25ff..9aac1a7e1 100644 --- a/src/components/Ecogesture/EcogestureModal.spec.tsx +++ b/src/components/Ecogesture/EcogestureModal.spec.tsx @@ -6,15 +6,11 @@ import { mockedEcogesturesData } from '../../../tests/__mocks__/ecogesturesData. import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() jest.mock('utils/utils', () => { return { diff --git a/src/components/Ecogesture/EcogestureReinitModal.spec.tsx b/src/components/Ecogesture/EcogestureReinitModal.spec.tsx index 2e91ba2e6..9bb6ec44b 100644 --- a/src/components/Ecogesture/EcogestureReinitModal.spec.tsx +++ b/src/components/Ecogesture/EcogestureReinitModal.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureReinitModal from './EcogestureReinitModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() jest.mock('utils/utils', () => { return { diff --git a/src/components/Ecogesture/EcogestureView.spec.tsx b/src/components/Ecogesture/EcogestureView.spec.tsx index 47454b07a..b08d1e013 100644 --- a/src/components/Ecogesture/EcogestureView.spec.tsx +++ b/src/components/Ecogesture/EcogestureView.spec.tsx @@ -12,15 +12,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import EcogestureEmptyList from './EcogestureEmptyList' import EcogestureInitModal from './EcogestureInitModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockGetAllEcogestures = jest.fn() const mockGetEcogestureListByProfile = jest.fn() const mockInitEcogesture = jest.fn() diff --git a/src/components/Ecogesture/EfficiencyRating.spec.tsx b/src/components/Ecogesture/EfficiencyRating.spec.tsx index 1d3651780..f4e4d5238 100644 --- a/src/components/Ecogesture/EfficiencyRating.spec.tsx +++ b/src/components/Ecogesture/EfficiencyRating.spec.tsx @@ -3,15 +3,11 @@ import { mount } from 'enzyme' import toJson from 'enzyme-to-json' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('EfficiencyRating component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Ecogesture/SingleEcogesture.spec.tsx b/src/components/Ecogesture/SingleEcogesture.spec.tsx index 9553d54f0..6ecdc3c04 100644 --- a/src/components/Ecogesture/SingleEcogesture.spec.tsx +++ b/src/components/Ecogesture/SingleEcogesture.spec.tsx @@ -8,15 +8,11 @@ import { mockedEcogesturesData } from '../../../tests/__mocks__/ecogesturesData. import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/EcogestureForm/EcogestureFormEquipment.spec.tsx b/src/components/EcogestureForm/EcogestureFormEquipment.spec.tsx index f88bab5b3..b2c0171d6 100644 --- a/src/components/EcogestureForm/EcogestureFormEquipment.spec.tsx +++ b/src/components/EcogestureForm/EcogestureFormEquipment.spec.tsx @@ -8,15 +8,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import EcogestureFormEquipment from './EcogestureFormEquipment' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockSetPreviousStep = jest.fn() const mockSetNextStep = jest.fn() const mockHistoryPush = jest.fn() diff --git a/src/components/EcogestureForm/EcogestureFormSingleChoice.spec.tsx b/src/components/EcogestureForm/EcogestureFormSingleChoice.spec.tsx index 00efadaab..ffcf2df03 100644 --- a/src/components/EcogestureForm/EcogestureFormSingleChoice.spec.tsx +++ b/src/components/EcogestureForm/EcogestureFormSingleChoice.spec.tsx @@ -15,15 +15,11 @@ import EcogestureFormSingleChoice from './EcogestureFormSingleChoice' const useSelectorSpy = jest.spyOn(reactRedux, 'useSelector') -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/EcogestureForm/EcogestureFormView.spec.tsx b/src/components/EcogestureForm/EcogestureFormView.spec.tsx index f1a22af12..75c3f6529 100644 --- a/src/components/EcogestureForm/EcogestureFormView.spec.tsx +++ b/src/components/EcogestureForm/EcogestureFormView.spec.tsx @@ -10,15 +10,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import EcogestureFormView from './EcogestureFormView' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/Header/CozyBar', () => 'mock-cozybar') jest.mock('components/Header/Header', () => 'mock-header') diff --git a/src/components/EcogestureForm/EcogestureLaunchFormModal.spec.tsx b/src/components/EcogestureForm/EcogestureLaunchFormModal.spec.tsx index 6bd433f49..1f0289958 100644 --- a/src/components/EcogestureForm/EcogestureLaunchFormModal.spec.tsx +++ b/src/components/EcogestureForm/EcogestureLaunchFormModal.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureLaunchFormModal from './EcogestureLaunchFormModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() describe('EcogestureLaunchFormModal component', () => { diff --git a/src/components/EcogestureForm/EquipmentIcon.spec.tsx b/src/components/EcogestureForm/EquipmentIcon.spec.tsx index ffb0703be..12bc96af6 100644 --- a/src/components/EcogestureForm/EquipmentIcon.spec.tsx +++ b/src/components/EcogestureForm/EquipmentIcon.spec.tsx @@ -6,15 +6,11 @@ import React from 'react' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import EquipmentIcon from './EquipmentIcon' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() jest.mock('utils/utils', () => { return { diff --git a/src/components/EcogestureSelection/EcogestureSelection.spec.tsx b/src/components/EcogestureSelection/EcogestureSelection.spec.tsx index 0ea212bcf..0605fda95 100644 --- a/src/components/EcogestureSelection/EcogestureSelection.spec.tsx +++ b/src/components/EcogestureSelection/EcogestureSelection.spec.tsx @@ -9,15 +9,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import EcogestureSelection from './EcogestureSelection' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('cozy-client', () => { return { useClient: jest.fn(() => { diff --git a/src/components/EcogestureSelection/EcogestureSelectionDetail.spec.tsx b/src/components/EcogestureSelection/EcogestureSelectionDetail.spec.tsx index 2aa3ec4a6..33778d5e0 100644 --- a/src/components/EcogestureSelection/EcogestureSelectionDetail.spec.tsx +++ b/src/components/EcogestureSelection/EcogestureSelectionDetail.spec.tsx @@ -6,15 +6,11 @@ import { mockedEcogesturesData } from '../../../tests/__mocks__/ecogesturesData. import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import EcogestureSelectionDetail from './EcogestureSelectionDetail' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockImportIconById = jest.fn() jest.mock('utils/utils', () => { return { diff --git a/src/components/EcogestureSelection/EcogestureSelectionEnd.spec.tsx b/src/components/EcogestureSelection/EcogestureSelectionEnd.spec.tsx index ee657cb0b..4af3daef4 100644 --- a/src/components/EcogestureSelection/EcogestureSelectionEnd.spec.tsx +++ b/src/components/EcogestureSelection/EcogestureSelectionEnd.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureSelectionEnd from './EcogestureSelectionEnd' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/EcogestureSelection/EcogestureSelectionModal.spec.tsx b/src/components/EcogestureSelection/EcogestureSelectionModal.spec.tsx index 26ab115f3..7f83daeea 100644 --- a/src/components/EcogestureSelection/EcogestureSelectionModal.spec.tsx +++ b/src/components/EcogestureSelection/EcogestureSelectionModal.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureSelectionModal from './EcogestureSelectionModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() describe('EcogestureInitModal component', () => { diff --git a/src/components/EcogestureSelection/EcogestureSelectionRestart.spec.tsx b/src/components/EcogestureSelection/EcogestureSelectionRestart.spec.tsx index d13a55a6d..ded77ef64 100644 --- a/src/components/EcogestureSelection/EcogestureSelectionRestart.spec.tsx +++ b/src/components/EcogestureSelection/EcogestureSelectionRestart.spec.tsx @@ -4,15 +4,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import EcogestureSelectionRestart from './EcogestureSelectionRestart' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Exploration/ExplorationError.spec.tsx b/src/components/Exploration/ExplorationError.spec.tsx index ad7f3fd3a..389ed334e 100644 --- a/src/components/Exploration/ExplorationError.spec.tsx +++ b/src/components/Exploration/ExplorationError.spec.tsx @@ -2,15 +2,11 @@ import ExplorationError from 'components/Exploration/ExplorationError' import { shallow } from 'enzyme' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Exploration/ExplorationFinished.spec.tsx b/src/components/Exploration/ExplorationFinished.spec.tsx index b7b08c462..c6a173a57 100644 --- a/src/components/Exploration/ExplorationFinished.spec.tsx +++ b/src/components/Exploration/ExplorationFinished.spec.tsx @@ -7,15 +7,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import ExplorationFinished from './ExplorationFinished' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Exploration/ExplorationOngoing.spec.tsx b/src/components/Exploration/ExplorationOngoing.spec.tsx index 278236744..314f9fa02 100644 --- a/src/components/Exploration/ExplorationOngoing.spec.tsx +++ b/src/components/Exploration/ExplorationOngoing.spec.tsx @@ -5,15 +5,11 @@ import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUserChallengeUpdateFlag = jest.fn() const mockIsChallengeDone = jest.fn() diff --git a/src/components/Exploration/ExplorationView.spec.tsx b/src/components/Exploration/ExplorationView.spec.tsx index 640ab07f0..137f6105d 100644 --- a/src/components/Exploration/ExplorationView.spec.tsx +++ b/src/components/Exploration/ExplorationView.spec.tsx @@ -10,15 +10,11 @@ import ExplorationFinished from './ExplorationFinished' import ExplorationOngoing from './ExplorationOngoing' import ExplorationView from './ExplorationView' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Export/exportDoneModal.spec.tsx b/src/components/Export/exportDoneModal.spec.tsx index b8d12e0a2..291fac79c 100644 --- a/src/components/Export/exportDoneModal.spec.tsx +++ b/src/components/Export/exportDoneModal.spec.tsx @@ -6,15 +6,11 @@ import React from 'react' import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() diff --git a/src/components/Export/exportLoadingModal.spec.tsx b/src/components/Export/exportLoadingModal.spec.tsx index 57534eb65..a34c49e86 100644 --- a/src/components/Export/exportLoadingModal.spec.tsx +++ b/src/components/Export/exportLoadingModal.spec.tsx @@ -6,15 +6,11 @@ import React from 'react' import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() const mockHandleDone = jest.fn() diff --git a/src/components/Export/exportStartModal.spec.tsx b/src/components/Export/exportStartModal.spec.tsx index d23c4598b..b7381ccc2 100644 --- a/src/components/Export/exportStartModal.spec.tsx +++ b/src/components/Export/exportStartModal.spec.tsx @@ -6,15 +6,11 @@ import React from 'react' import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() const mockHandleDownloadClick = jest.fn() diff --git a/src/components/Feedback/FeedbackModal.spec.tsx b/src/components/Feedback/FeedbackModal.spec.tsx index 1dca3caac..361b5689c 100644 --- a/src/components/Feedback/FeedbackModal.spec.tsx +++ b/src/components/Feedback/FeedbackModal.spec.tsx @@ -9,15 +9,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' // Value coming from jest.config declare let __SAU_LINK__: string -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('services/environment.service', () => { return jest.fn(() => { diff --git a/src/components/FormGlobal/FormNavigation.spec.tsx b/src/components/FormGlobal/FormNavigation.spec.tsx index d620db074..9e4a166e6 100644 --- a/src/components/FormGlobal/FormNavigation.spec.tsx +++ b/src/components/FormGlobal/FormNavigation.spec.tsx @@ -6,15 +6,11 @@ import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import FormNavigation from './FormNavigation' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/HalfHourNoData/HalfHourNoData.spec.tsx b/src/components/HalfHourNoData/HalfHourNoData.spec.tsx index ff7c1481a..a5c625607 100644 --- a/src/components/HalfHourNoData/HalfHourNoData.spec.tsx +++ b/src/components/HalfHourNoData/HalfHourNoData.spec.tsx @@ -2,15 +2,11 @@ import { mount } from 'enzyme' import React from 'react' import HalfHourNoData from './HalfHourNoData' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('HalfHourNoData component', () => { it('should render correctly HalfHourNoData', () => { diff --git a/src/components/Header/CozyBar.spec.tsx b/src/components/Header/CozyBar.spec.tsx index 952313112..8f195ae4b 100644 --- a/src/components/Header/CozyBar.spec.tsx +++ b/src/components/Header/CozyBar.spec.tsx @@ -19,15 +19,11 @@ jest.mock('utils/cozyBar', () => { } }) -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Header/Header.spec.tsx b/src/components/Header/Header.spec.tsx index 757488f24..21124ae9a 100644 --- a/src/components/Header/Header.spec.tsx +++ b/src/components/Header/Header.spec.tsx @@ -6,15 +6,11 @@ import { Provider } from 'react-redux' import * as ModalAction from 'store/modal/modal.slice' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Home/ConsumptionDetails.spec.tsx b/src/components/Home/ConsumptionDetails.spec.tsx index 1e326b7ec..dc82714f2 100644 --- a/src/components/Home/ConsumptionDetails.spec.tsx +++ b/src/components/Home/ConsumptionDetails.spec.tsx @@ -8,15 +8,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import ConsumptionDetails from './ConsumptionDetails' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUseSelector = jest.spyOn(reactRedux, 'useSelector') diff --git a/src/components/Home/ConsumptionView.spec.tsx b/src/components/Home/ConsumptionView.spec.tsx index f5be5f225..a48484935 100644 --- a/src/components/Home/ConsumptionView.spec.tsx +++ b/src/components/Home/ConsumptionView.spec.tsx @@ -20,15 +20,11 @@ import { } from '../../../tests/__mocks__/store' import ConsumptionView from './ConsumptionView' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUpdateProfile = jest.fn() jest.mock('services/profile.service', () => { return jest.fn(() => { diff --git a/src/components/Home/FluidButton.spec.tsx b/src/components/Home/FluidButton.spec.tsx index 6bc674ea1..c7451b9e3 100644 --- a/src/components/Home/FluidButton.spec.tsx +++ b/src/components/Home/FluidButton.spec.tsx @@ -12,15 +12,11 @@ import { import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import FluidButton from './FluidButton' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Home/FluidButtons.spec.tsx b/src/components/Home/FluidButtons.spec.tsx index 08e569ac5..065798c72 100644 --- a/src/components/Home/FluidButtons.spec.tsx +++ b/src/components/Home/FluidButtons.spec.tsx @@ -7,15 +7,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import FluidButtons from './FluidButtons' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Konnector/KonnectorModal.spec.tsx b/src/components/Konnector/KonnectorModal.spec.tsx index 818ac1a95..695743361 100644 --- a/src/components/Konnector/KonnectorModal.spec.tsx +++ b/src/components/Konnector/KonnectorModal.spec.tsx @@ -9,15 +9,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import KonnectorModal from './KonnectorModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Konnector/KonnectorModalFooter.spec.tsx b/src/components/Konnector/KonnectorModalFooter.spec.tsx index 2502794d9..4845a8b21 100644 --- a/src/components/Konnector/KonnectorModalFooter.spec.tsx +++ b/src/components/Konnector/KonnectorModalFooter.spec.tsx @@ -11,15 +11,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import KonnectorModalFooter from './KonnectorModalFooter' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Konnector/KonnectorViewerList.spec.tsx b/src/components/Konnector/KonnectorViewerList.spec.tsx index c22184392..dec26ab13 100644 --- a/src/components/Konnector/KonnectorViewerList.spec.tsx +++ b/src/components/Konnector/KonnectorViewerList.spec.tsx @@ -6,15 +6,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import KonnectorViewerList from './KonnectorViewerList' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Loader/Loader.spec.tsx b/src/components/Loader/Loader.spec.tsx index 231c5b013..729e3afb5 100644 --- a/src/components/Loader/Loader.spec.tsx +++ b/src/components/Loader/Loader.spec.tsx @@ -3,15 +3,11 @@ import { mount } from 'enzyme' import React from 'react' import Loader from './Loader' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('Loader component', () => { it('should render base Loader', () => { diff --git a/src/components/Navbar/Navbar.spec.tsx b/src/components/Navbar/Navbar.spec.tsx index 77ed83fe0..ea55dc32e 100644 --- a/src/components/Navbar/Navbar.spec.tsx +++ b/src/components/Navbar/Navbar.spec.tsx @@ -5,15 +5,11 @@ import { Provider } from 'react-redux' import { BrowserRouter } from 'react-router-dom' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('Navbar component', () => { it('should be rendered correctly with 5 navlink', () => { diff --git a/src/components/Options/ExportData/ExportData.spec.tsx b/src/components/Options/ExportData/ExportData.spec.tsx index e4f7b336f..bbf9d4418 100644 --- a/src/components/Options/ExportData/ExportData.spec.tsx +++ b/src/components/Options/ExportData/ExportData.spec.tsx @@ -5,15 +5,11 @@ import mockClient from '../../../../tests/__mocks__/client' import ExportData from './ExportData' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('services/consumption.service', () => { return jest.fn(() => { return { diff --git a/src/components/Options/GCU/GCULink.spec.tsx b/src/components/Options/GCU/GCULink.spec.tsx index cf64c957d..acbae4f38 100644 --- a/src/components/Options/GCU/GCULink.spec.tsx +++ b/src/components/Options/GCU/GCULink.spec.tsx @@ -2,15 +2,11 @@ import LegalNoticeLink from 'components/Options/LegalNotice/LegalNoticeLink' import { shallow } from 'enzyme' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('LegalNoticeLink component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Options/LegalNotice/LegalNoticeContent.spec.tsx b/src/components/Options/LegalNotice/LegalNoticeContent.spec.tsx index ed6459952..4316fa7b4 100644 --- a/src/components/Options/LegalNotice/LegalNoticeContent.spec.tsx +++ b/src/components/Options/LegalNotice/LegalNoticeContent.spec.tsx @@ -2,15 +2,11 @@ import LegalNoticeContent from 'components/Options/LegalNotice/LegalNoticeConten import { shallow } from 'enzyme' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('LegalNoticeContent component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Options/LegalNotice/LegalNoticeLink.spec.tsx b/src/components/Options/LegalNotice/LegalNoticeLink.spec.tsx index dcea07158..e4cc40d63 100644 --- a/src/components/Options/LegalNotice/LegalNoticeLink.spec.tsx +++ b/src/components/Options/LegalNotice/LegalNoticeLink.spec.tsx @@ -2,15 +2,11 @@ import GCULink from 'components/Options/GCU/GCULink' import { shallow } from 'enzyme' import React from 'react' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('GCULink component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Options/MatomoOptOut/MatomoOptOut.spec.tsx b/src/components/Options/MatomoOptOut/MatomoOptOut.spec.tsx index c74c68c3b..31f4ab7bb 100644 --- a/src/components/Options/MatomoOptOut/MatomoOptOut.spec.tsx +++ b/src/components/Options/MatomoOptOut/MatomoOptOut.spec.tsx @@ -2,15 +2,11 @@ import { shallow } from 'enzyme' import React from 'react' import MatomoOptOut from './MatomoOptOut' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('MatomoOptOut component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.spec.tsx b/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.spec.tsx index e3a1893c7..cde7d357c 100644 --- a/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.spec.tsx +++ b/src/components/Options/ProfileTypeOptions/ProfileTypeOptions.spec.tsx @@ -18,15 +18,11 @@ import { mockProfileState, } from '../../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Options/ReportOptions/ReportOptions.spec.tsx b/src/components/Options/ReportOptions/ReportOptions.spec.tsx index baaeff3f3..646027c01 100644 --- a/src/components/Options/ReportOptions/ReportOptions.spec.tsx +++ b/src/components/Options/ReportOptions/ReportOptions.spec.tsx @@ -11,15 +11,11 @@ import { mockInitialEcolyoState, } from '../../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUpdateProfile = jest.fn() jest.mock('services/profile.service', () => { diff --git a/src/components/Options/Unsubscribe/UnSubscribe.spec.tsx b/src/components/Options/Unsubscribe/UnSubscribe.spec.tsx index f1b1dc382..9495dc1cf 100644 --- a/src/components/Options/Unsubscribe/UnSubscribe.spec.tsx +++ b/src/components/Options/Unsubscribe/UnSubscribe.spec.tsx @@ -7,15 +7,11 @@ import * as profileActions from 'store/profile/profile.actions' import { createMockEcolyoStore } from '../../../../tests/__mocks__/store' import UnSubscribe from './UnSubscribe' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('components/Header/CozyBar', () => 'mock-cozybar') jest.mock('components/Header/Header', () => 'mock-header') jest.mock('components/Content/Content', () => 'mock-content') diff --git a/src/components/PartnerIssue/PartnerIssueModal.spec.tsx b/src/components/PartnerIssue/PartnerIssueModal.spec.tsx index 33df065aa..2bbe0c57f 100644 --- a/src/components/PartnerIssue/PartnerIssueModal.spec.tsx +++ b/src/components/PartnerIssue/PartnerIssueModal.spec.tsx @@ -5,15 +5,11 @@ import React from 'react' import { mockInitialEcolyoState } from '../../../tests/__mocks__/store' import PartnerIssueModal from './PartnerIssueModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHandleClose = jest.fn() describe('PartnerIssueModal component', () => { diff --git a/src/components/ProfileType/ProfileTypeFinished.spec.tsx b/src/components/ProfileType/ProfileTypeFinished.spec.tsx index 0b4dda620..e100ecd8d 100644 --- a/src/components/ProfileType/ProfileTypeFinished.spec.tsx +++ b/src/components/ProfileType/ProfileTypeFinished.spec.tsx @@ -16,15 +16,11 @@ jest.mock('react-router-dom', () => ({ }), useNavigate: () => mockedNavigate, })) -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockAddEvent = jest.fn() jest.mock('services/usageEvent.service') UsageEventService.addEvent = mockAddEvent diff --git a/src/components/ProfileType/ProfileTypeFormMultiChoice.spec.tsx b/src/components/ProfileType/ProfileTypeFormMultiChoice.spec.tsx index 5d4160e1f..631295947 100644 --- a/src/components/ProfileType/ProfileTypeFormMultiChoice.spec.tsx +++ b/src/components/ProfileType/ProfileTypeFormMultiChoice.spec.tsx @@ -9,15 +9,11 @@ import { import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import ProfileTypeFormMultiChoice from './ProfileTypeFormMultiChoice' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/ProfileType/ProfileTypeFormNumber.spec.tsx b/src/components/ProfileType/ProfileTypeFormNumber.spec.tsx index c9b0f6aea..34aa9e69e 100644 --- a/src/components/ProfileType/ProfileTypeFormNumber.spec.tsx +++ b/src/components/ProfileType/ProfileTypeFormNumber.spec.tsx @@ -9,15 +9,11 @@ import { import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import ProfileTypeFormNumber from './ProfileTypeFormNumber' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/ProfileType/ProfileTypeFormNumberSelection.spec.tsx b/src/components/ProfileType/ProfileTypeFormNumberSelection.spec.tsx index ce1e6210a..9214b90f5 100644 --- a/src/components/ProfileType/ProfileTypeFormNumberSelection.spec.tsx +++ b/src/components/ProfileType/ProfileTypeFormNumberSelection.spec.tsx @@ -9,15 +9,11 @@ import { import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import ProfileTypeFormNumberSelection from './ProfileTypeFormNumberSelection' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/ProfileType/ProfileTypeFormSingleChoice.spec.tsx b/src/components/ProfileType/ProfileTypeFormSingleChoice.spec.tsx index f4c4e4e8a..2250e2a47 100644 --- a/src/components/ProfileType/ProfileTypeFormSingleChoice.spec.tsx +++ b/src/components/ProfileType/ProfileTypeFormSingleChoice.spec.tsx @@ -9,15 +9,11 @@ import { import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import ProfileTypeFormSingleChoice from './ProfileTypeFormSingleChoice' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/ProfileType/ProfileTypeView.spec.tsx b/src/components/ProfileType/ProfileTypeView.spec.tsx index 466f3939c..4c360ea56 100644 --- a/src/components/ProfileType/ProfileTypeView.spec.tsx +++ b/src/components/ProfileType/ProfileTypeView.spec.tsx @@ -4,15 +4,11 @@ import React from 'react' import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Quiz/QuizBegin.spec.tsx b/src/components/Quiz/QuizBegin.spec.tsx index 7fccfb0b0..20df0a706 100644 --- a/src/components/Quiz/QuizBegin.spec.tsx +++ b/src/components/Quiz/QuizBegin.spec.tsx @@ -8,15 +8,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import QuizBegin from './QuizBegin' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUserChallengeUpdateFlag = jest.fn() jest.mock('services/challenge.service', () => { diff --git a/src/components/Quiz/QuizCustomQuestionContent.spec.tsx b/src/components/Quiz/QuizCustomQuestionContent.spec.tsx index 5a616af2c..5f355a86c 100644 --- a/src/components/Quiz/QuizCustomQuestionContent.spec.tsx +++ b/src/components/Quiz/QuizCustomQuestionContent.spec.tsx @@ -9,15 +9,11 @@ import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mo import QuizCustomQuestionContent from './QuizCustomQuestionContent' import QuizExplanationModal from './QuizExplanationModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHistoryPush = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Quiz/QuizFinish.spec.tsx b/src/components/Quiz/QuizFinish.spec.tsx index 4556bc1c7..f028d62f9 100644 --- a/src/components/Quiz/QuizFinish.spec.tsx +++ b/src/components/Quiz/QuizFinish.spec.tsx @@ -9,15 +9,11 @@ import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import QuizFinish from './QuizFinish' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUserChallengeUpdateFlag = jest.fn() jest.mock('services/challenge.service', () => { diff --git a/src/components/Quiz/QuizQuestion.spec.tsx b/src/components/Quiz/QuizQuestion.spec.tsx index 16a951db3..8fade6b52 100644 --- a/src/components/Quiz/QuizQuestion.spec.tsx +++ b/src/components/Quiz/QuizQuestion.spec.tsx @@ -8,15 +8,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' import QuizQuestion from './QuizQuestion' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockHistoryPush = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Quiz/QuizQuestionContent.spec.tsx b/src/components/Quiz/QuizQuestionContent.spec.tsx index 5e3bbc6d1..093cc6be3 100644 --- a/src/components/Quiz/QuizQuestionContent.spec.tsx +++ b/src/components/Quiz/QuizQuestionContent.spec.tsx @@ -5,15 +5,11 @@ import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockedNavigate = jest.fn() jest.mock('react-router-dom', () => ({ diff --git a/src/components/Quiz/QuizView.spec.tsx b/src/components/Quiz/QuizView.spec.tsx index 237ceadd5..9d3ccb2c8 100644 --- a/src/components/Quiz/QuizView.spec.tsx +++ b/src/components/Quiz/QuizView.spec.tsx @@ -15,15 +15,11 @@ import QuizBegin from './QuizBegin' import QuizFinish from './QuizFinish' import QuizQuestion from './QuizQuestion' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), diff --git a/src/components/Splash/SplashRoot.spec.tsx b/src/components/Splash/SplashRoot.spec.tsx index d5da9a254..66bceb670 100644 --- a/src/components/Splash/SplashRoot.spec.tsx +++ b/src/components/Splash/SplashRoot.spec.tsx @@ -12,15 +12,11 @@ jest.mock('@sentry/react', () => ({ startTransaction: () => ({ finish: jest.fn() }), })) -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockUseDispatch = jest.spyOn(reactRedux, 'useDispatch') describe('SplashRoot component', () => { diff --git a/src/components/Splash/SplashScreen.spec.tsx b/src/components/Splash/SplashScreen.spec.tsx index f84d63983..98c55a3c2 100644 --- a/src/components/Splash/SplashScreen.spec.tsx +++ b/src/components/Splash/SplashScreen.spec.tsx @@ -4,15 +4,11 @@ import { InitSteps } from 'models/initialisationSteps.model' import React from 'react' import SplashScreen from './SplashScreen' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('SplashScreen component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Splash/SplashScreenError.spec.tsx b/src/components/Splash/SplashScreenError.spec.tsx index 2c5fceffb..aa759feb5 100644 --- a/src/components/Splash/SplashScreenError.spec.tsx +++ b/src/components/Splash/SplashScreenError.spec.tsx @@ -5,15 +5,11 @@ import { InitStepsErrors } from 'models/initialisationSteps.model' import React from 'react' import SplashScreenError from './SplashScreenError' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('SplashScreenError component', () => { const reload = window.location.reload diff --git a/src/components/Terms/CGUModal.spec.tsx b/src/components/Terms/CGUModal.spec.tsx index 154bfef85..3cbbcf8a5 100644 --- a/src/components/Terms/CGUModal.spec.tsx +++ b/src/components/Terms/CGUModal.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import CGUModal from './CGUModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('CGUModal component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Terms/DataShareConsentContent.spec.tsx b/src/components/Terms/DataShareConsentContent.spec.tsx index 0c361b53b..f214a2947 100644 --- a/src/components/Terms/DataShareConsentContent.spec.tsx +++ b/src/components/Terms/DataShareConsentContent.spec.tsx @@ -5,15 +5,11 @@ import { Provider } from 'react-redux' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import DataShareConsentContent from './DataShareConsentContent' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('DataShareConsentContent component', () => { it('should be rendered correctly with first connexion text', () => { diff --git a/src/components/Terms/LegalNoticeModal.spec.tsx b/src/components/Terms/LegalNoticeModal.spec.tsx index daf575847..ccc09d963 100644 --- a/src/components/Terms/LegalNoticeModal.spec.tsx +++ b/src/components/Terms/LegalNoticeModal.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import LegalNoticeModal from './LegalNoticeModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('LegalNoticeModal component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Terms/MinorUpdateContent.spec.tsx b/src/components/Terms/MinorUpdateContent.spec.tsx index 642be1f80..ac15474dd 100644 --- a/src/components/Terms/MinorUpdateContent.spec.tsx +++ b/src/components/Terms/MinorUpdateContent.spec.tsx @@ -3,15 +3,11 @@ import toJson from 'enzyme-to-json' import React from 'react' import MinorUpdateContent from './MinorUpdateContent' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) describe('Minor update content component', () => { it('should be rendered correctly', () => { diff --git a/src/components/Terms/TermsView.spec.tsx b/src/components/Terms/TermsView.spec.tsx index 93e84f3bf..1ed51854d 100644 --- a/src/components/Terms/TermsView.spec.tsx +++ b/src/components/Terms/TermsView.spec.tsx @@ -8,15 +8,11 @@ import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { mockUpToDateTerm } from '../../../tests/__mocks__/termsData.mock' import TermsView from './TermsView' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockCreateTerm = jest.fn() const mockGetTermsVersionType = jest.fn() diff --git a/src/components/TimeStepSelector/TimeStepSelector.spec.tsx b/src/components/TimeStepSelector/TimeStepSelector.spec.tsx index d22541d4a..5961840a9 100644 --- a/src/components/TimeStepSelector/TimeStepSelector.spec.tsx +++ b/src/components/TimeStepSelector/TimeStepSelector.spec.tsx @@ -13,15 +13,11 @@ import * as chartActions from 'store/chart/chart.slice' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('services/usageEvent.service') const mockAddEvent = jest.fn() UsageEventService.addEvent = mockAddEvent diff --git a/src/components/TotalConsumption/TotalConsumption.spec.tsx b/src/components/TotalConsumption/TotalConsumption.spec.tsx index 44d7cbb3e..a54492bc2 100644 --- a/src/components/TotalConsumption/TotalConsumption.spec.tsx +++ b/src/components/TotalConsumption/TotalConsumption.spec.tsx @@ -11,15 +11,11 @@ import { import { waitForComponentToPaint } from '../../../tests/__mocks__/testUtils' import TotalConsumption from './TotalConsumption' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) const mockChartStore = createMockEcolyoStore({ chart: { diff --git a/src/components/WelcomeModal/WelcomeModal.spec.tsx b/src/components/WelcomeModal/WelcomeModal.spec.tsx index 53a16a037..4a60f98b8 100644 --- a/src/components/WelcomeModal/WelcomeModal.spec.tsx +++ b/src/components/WelcomeModal/WelcomeModal.spec.tsx @@ -8,15 +8,11 @@ import mockClient from '../../../tests/__mocks__/client' import { createMockEcolyoStore } from '../../../tests/__mocks__/store' import WelcomeModal from './WelcomeModal' -jest.mock('cozy-ui/transpiled/react/I18n', () => { - return { - useI18n: jest.fn(() => { - return { - t: (str: string) => str, - } - }), - } -}) +jest.mock('cozy-ui/transpiled/react/I18n', () => ({ + useI18n: jest.fn(() => ({ + t: (str: string) => str, + })), +})) jest.mock('cozy-client', () => { return { useClient: jest.fn(() => mockClient), diff --git a/src/store/chart/chart.slice.spec.ts b/src/store/chart/chart.slice.spec.ts index 69842d675..48dfa4e9a 100644 --- a/src/store/chart/chart.slice.spec.ts +++ b/src/store/chart/chart.slice.spec.ts @@ -1,7 +1,7 @@ import { TimeStep } from 'enum/timeStep.enum' import { DateTime } from 'luxon' import { graphData } from '../../../tests/__mocks__/chartData.mock' -import { mockChartState } from '../../../tests/__mocks__/store/chart.state.mock' +import { mockChartState } from '../../../tests/__mocks__/store' import { chartSlice, setCurrentDataChart, diff --git a/src/store/profileType/profileType.slice.spec.ts b/src/store/profileType/profileType.slice.spec.ts index 380b750d4..2cd73624b 100644 --- a/src/store/profileType/profileType.slice.spec.ts +++ b/src/store/profileType/profileType.slice.spec.ts @@ -13,7 +13,7 @@ import { } from 'enum/profileType.enum' import { DateTime } from 'luxon' import { ProfileType } from 'models' -import { mockProfileTypeState } from '../../../tests/__mocks__/store/profileType.state.mock' +import { mockProfileTypeState } from '../../../tests/__mocks__/store' import { profileTypeSlice, setProfileType } from './profileType.slice' describe('profileType reducer', () => { -- GitLab