diff --git a/src/components/Action/ActionBegin.spec.tsx b/src/components/Action/ActionBegin.spec.tsx index a1a87fe0f4779a1399cd0176a62c971af3855b08..cdc6b00e928bc1f80a8e55b89354fbaf21fb0c4d 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 cfd33fedee5aa17135e7a93f9e9fdcd791d5f2b4..b859485d95559b273ca24fece3f2f28d516e68b6 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 147ac73cb0a0155a53083b5713bc433058b1db04..5964cac6e308dda9b72d6602bd22e3a99b1be8fb 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 d0ef0648aa64f00fdf0f7f7bc26de46db80ea087..8cd504e7c9d89458e16bd10ad3fcf3885f36435d 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 358a734bb51d08c9539bcb7c653d37cfb688cd26..3da60b4795ba17d9b0a5140ecf7666ec5a6998ef 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 63083f90b99b2e3b117bb9e5fb69795a5334f4e4..153acd6faacf0805e9c0edf874fa3a1f60d4b3e5 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 06a4e5d786953f2f083715dc46f160d564975271..e4d9d1be16dceebbb953cac3f16a3b879220a87d 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 710e0fbd347a6c9c35089cb96f52fe3616338237..be9251b1467ec1026be2861c9139d42a299721f0 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 f676bedb788c1ffeb65bf8d1691467889f998976..9e8e469ea309c49fca1c0afedbfc6ec49c6395e7 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 44006e40b620bee51e1262c222bc4b90646be40d..fd5718d4086c8d48fa131e754cf37bd8b3965a65 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 cf7a593eefab0e700213b45c9f3833347dc83a8f..ca9c022fe2fd433c008edb633586004a3bc781e6 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 a3207082fa69a5d0ee49f4bcf92aa7bf47a84057..7dba81723472e81684336ada81a404b31ee39de5 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 d6cfe69bbd6c2e3c3efa4cb73bbaba1a8b378638..d1ef094eeb19bc0ce16df5cc4870e09c033c4125 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 eee85b61c9916dbd2e5249b71b0b8344faf07eb5..5168b4c45fbdbd3e8b65d6302c9930581ca7ff45 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 d67215220d36acbff0746b44529e6ec7eb275cb9..ca8ee2671106a95a17ddb5cadff4e863dc6891d7 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 6691932a7227630d155936ed0803aaa66de9b903..07a0f809639ae00099d8c76c664e39acbb1e7d4c 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 58a58e09bcca94969ad5455642f331905766672e..1586ba71bcedaf1d886f9a659d049f1989f41a08 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 bfef8f1cacdb4bf135e609356c5f52f1bd8c6daa..c3b08b9ea73986ba2b6191901e74e08541090c1b 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 9519e7e99752c02f3c2ee0f63afecbfd833e1c90..8cd8bbc4905127b8e8b616a05260bfdf95317184 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 e447ca39f94588f1d0fee157b1a693b61826d331..07371a118bd120b2a9ec85ed01d9bed5cd09845b 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 2f24464a8b320dc13620ef1572a969e7c89b32f7..027b0268a8f52a745ded159605419471feb3cf0d 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 e1a908384465a0664bf0cbaeaea20359df89cb31..ca7f554f949cb623ab4cb965abaf2690225eb76e 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 470b80932f30f0117695e79875cd74c4e18f7154..13cb72235c2e921b95a7d37d006a05a4016e2c95 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 8e92291ead926ea84d3e21d875936e2f310ce18a..e223c20f9a7fed67a626e148b6c312732b705fc8 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 63095bbceb1e071c0071b72b0248c5a640dc5072..d8eee49294d6fa5475da093b816310e7100ff3b3 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 668eb4e85347ac357817fadbc1188848c7f8ed74..66f7230e2289caec50760f4ef6313e20c0a657c5 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 a8ae270354fbf7de7d1f9ceef066018da6e53db5..685b0f43c3611c73af46c5d36f7f5669fbedf4ce 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 c44b0d8d98f030d6d6e8f74aa2dfbc196c401dc5..05bc2fcbbb4d4b339f44783b37b8fb7f92da2d9c 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 1772e89ff42cad50f04e69a7d50bc2b2f3eebe38..f0df05f18034513c26283c6cd18c03f099eef215 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 9450e052f8a28c8daeebbbeb3f00adabe959275d..93cea948d5cfa8cde4fe42c82e194fb9afb72f90 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 a7f2adf28fddb4a567fdbb714487f195ccc13505..a6f9f8fd42ab06fd5d8c2457600ce0b0c7355500 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 8cdce76971c2fdf0c8b64b155b6aa72d29e8de72..a65895112383cc8f006d252cb591d0182d4218ab 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 724b247419902dfb0f7f49262e5add10d294d7b6..e2e28ffb33f3d71b0e266a3c8ac8349818165a7f 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 04512dcf30365c1a93ae387a33ad03180f910b29..b4099e1f69ea70e8db4edb598ae0806465a1085b 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 9bc479799b34b099c204ab8b3047b90da355d2bf..9cc71083d3e83fd51feec75fde33a97ffbd06b2a 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 451ac3785f55eee76651c9f2e7f0e92ba4419322..392b56f33fd510361056ff2b1262aea2b3acdb59 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 34860ce4bcc1b3ed84a8f910d968ba259178ccfd..722ba9054a495d88cd74ef11168b39e49c530fba 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 775c015bb5973187000382d94e075e7cf65b36ae..f3ae34bb9ecc28a1e3791e7878a5f717b4001f03 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 8dff84828bf4e4d4803c9035969db86858c99a8e..2c35790bcc884af2238dbcf57ea7a3ebac759833 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 32f5bea2191f47acaaf765256569cfb3aeb34cb8..ebfbc8f31bbdb0bf6d8d781f3ce8b265b0b4c814 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 677ebe1a5dc112445d9509ef8287f27630155f2f..25a3ae337b518ce0ffc243493e4bf21622115ef8 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 1604ac509cbe4eb41c061242906a9f84c8ac6a78..58b511e700a4421723ed9870a5a58c156c8b6e61 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 4409bb8b4daaf5f896410b215b3353491382188c..250e959f535461ed203a62bf1d3f227ac389a46b 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 37aa7ad42b7580f173ff0c8d9ab26549e7184375..0de0cb23cc02573dd090caab5627a8c765ba9312 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 4b8d40505f2bcc826f0aefe3a82004c3c3a371d8..44fa9239fca30913f95b803af1048f33afdbe9c0 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 845c8722cc606e65cba16fefc2ef938b3af8aa3a..9b7c41f59035b16acb3efa9271af858f175581aa 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 741a4f4a40ee2611ea6025a842027eb693d07b0c..8c6691f72898966169114991f266e871dc70e9d3 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 1e7314f2457cb4d7e78f7b0a44400177df4bd1ef..775b744bb5d77fb36c26277b584dfb34689ac82d 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 3a8c92a30547631661a7fc0b0c1eedf65e0aa920..10cacec7de03c26375bf7510068dba69978df024 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 2025ed96b9bf4d12e0cb7dac987fe4508b7ac80a..c3ba0cf227f157e875be2b5bc9c4526e5139a470 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 3fa783215008fa9ecdfe803ee74109f0e460945f..ebe4ee5c931c3660527ba09763eeae61d3c7ae06 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 aa1c26362a909732e1ce40a727aec479e97983d7..2c6a3e193045ae77501f3d75fe975d3d352f3da2 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 f0b613baf54bda9ad27aeb6d248071f35b1cf210..e907ad576034d399541f3f4ecb30ab371758947c 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 b27adc651fbc3b64befae331b242718fe5c0b923..b5e1b476f7beb65d6a79b5e535c41d013c070a1b 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 41980af0f29a9f8a93f8df9c2a638939f259c875..e6d11ab23243b0c647232ec8e1947682347ca3c4 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 a3e1543acbf23ce8fc518d0994a0490f7b252608..47c4af89762cdfdc55bb99e22c17c855f1898b9b 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 0e14bb67e6479e7d9a7cb4ae46bf454d0dd1c274..21d10a3a5f92aeaf490d579156f5fe27edc05a39 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 fb3cf25ffecdfc0c50524c419edfbe78e9832f60..9aac1a7e11ef576d21afa597bd33fded8c19c2ab 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 2e91ba2e6357b72e79f853ffd6f725846dc8c31d..9bb6ec44bdf89e6702facebbbb8334be3ff2e571 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 47454b07a765efdf76e82692a1ee6b3e88d6e933..b08d1e0139b520fb21b9cb38accf05fcfd79dbfa 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 1d3651780dedc2594a5cfff8d7e05ca7dd4aca5a..f4e4d5238b1e3e6d916cc6666be2b5d138aaa148 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 9553d54f0bf50eddb9cdae1ad621293a139b7641..6ecdc3c04a367a44b065960ead2f4d867cf8d4a0 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 f88bab5b31b393a05101b69db2fc1c494ecd62c0..b2c0171d6aa560df44c69741c3a211020a7b50f4 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 00efadaab79ecac9d15e734d39336f13b88a55d2..ffcf2df03b700f465e69dc1bcfdeab2419ffafe0 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 f1a22af1208c4df1aff51026c85676ed8f1398b2..75c3f6529484f69c44dc9126f0f3a9ba199f6eb5 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 6bd433f4919213f871dfca5a987f1b9f9b1a03a5..1f02899586d6f5f39292cdd282ec026577cd3cc9 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 ffb0703be6559ae3837db6815ebaf6e9afdb933b..12bc96af6a41fd63cf1f9d7ba8042752120b361e 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 0ea212bcf337cf233ba62f50953545058b52694a..0605fda959dc17732cc4a3936e510f24ab9c3887 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 2aa3ec4a6a0fed87ca33f9d7fa48f1059a194e9d..33778d5e0f5f71bbe4e55ebd21bb3cabb10d223a 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 ee657cb0b79f616573ee3c668d69bc0e518c9f30..4af3daef4421820938602c6fec8ad31eb9f50951 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 26ab115f3d3ee24d956d2d92d483972555f6295f..7f83daeea5e7906a2d806ccd090991dd5b19f66f 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 d13a55a6d16e68606c69c4c04f212953572651f6..ded77ef64de974756e232a04e9584829df33726e 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 ad7f3fd3a839a4188f1cf5fd8ff24dc05d96fad6..389ed334e2ebd8b034a658c39fd57ad25398f400 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 b7b08c4626b98cae49db909832521a422e319d98..c6a173a57de8e2c7a53fe766826e083e5065831c 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 278236744713d87bfc43d9ebfcdca1176577881e..314f9fa0203ed21c9fbefba204de37c19a6e482f 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 640ab07f06a9c523e87055dc2caf36b6484b5900..137f6105d59e613c5d714db70a8321c73116301d 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 b8d12e0a2c8561aea26f48e50859272502084683..291fac79cb9512b92adee39ba9c8bd8e2d340028 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 57534eb6592db6f7070dcdaac677b07ad8b3ba54..a34c49e86a924aea28c020724a34c0eb685e377b 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 d23c4598b958c6ab24b3576c5b82d47e5faaa872..b7381ccc2fc1ec95ae97e04af58a390fc7fba9f8 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 1dca3caacb0d1d1aa33ba49000b44ff6931f6a57..361b5689cfaf24e23a8476bcce200799597f4eb2 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 d620db074e9130ad3e8b184669fd3ec36560e011..9e4a166e62e739cc777c7abe1a2c5cc58c2c53c3 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 ff7c1481a9cc6f01dea9d0e5c5a9daf5a186a462..a5c62560756dbedead4deb6e31669b553183bd48 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 9523131121a96675a2d1fbcf072deec29ed1f905..8f195ae4b8a6d2d5b60fb58c81279b25d24c34fd 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 757488f24413394d1a4fc91d8b67293479a0461d..21124ae9ae2c806724bf15aa353b8f96f77a9ce9 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 1e326b7ecbe90acda90f74d958c349c9a168df18..dc82714f2d0ace0aec0a92550e33708b3c268a3c 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 f5be5f225c29ddd6e1ddcacad9185020b500d4f9..a484849352b8b1cebf2836e25383a5ffe4e8d7fa 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 6bc674ea10ad0e2c519dc20f2e83da628177df39..c7451b9e359289176d1b53c46960914b765b5739 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 08e569ac59e4178e5fac2974993d89990544a194..065798c729485f85fc2ad133f34c648578fbabd4 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 818ac1a95d4e84d1f6337c22066cc457875e785a..695743361a2beb4ed194d755045caafea630c4df 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 2502794d98d3dc758f077d25ad401f679f2921bd..4845a8b21661d91a1a8333e3b77ceb566494ad47 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 c22184392a53b6481c04ddedb83b943138c32874..dec26ab139384a05ec2c98143c03069a9ff86409 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 231c5b013606758b577ee2be1abef4973f99fa88..729e3afb5cd58ca7d7b5a203eaf14ce99a4e5bd8 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 77ed83fe0153f33dcbaf9e3ddc4064e49a7ea254..ea55dc32e361c0e67b85344818fc2acddbbdcd85 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 e4f7b336f3f4b1e54011f3451543f0fdf94cc54f..bbf9d44180eab8da9a56dd2b180e7654ff18dfb9 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 cf64c957da4db31d4223ace43ded22753cb9d094..acbae4f38e8eebfa627ebb5520eef62175c42866 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 ed6459952bfe193088413580e22590772e697415..4316fa7b4566de16e46db741a3dd21dccea41554 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 dcea071586f5b63f1e8e1dcdcfd9ee0e1956bcd6..e4cc40d630564e3ca1124c25d25d427b2f90bd57 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 c74c68c3b5a31ece0daaf62befb2bc232697559a..31f4ab7bbe2725bfc636f12e0125ddb71f77acba 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 e3a1893c7749c169f6fa96f9e32f0056de2989e8..cde7d357c0411972d04213aff5adf2eb033bc0e3 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 baaeff3f3d1591037497778c6148ee9c0119c277..646027c019fbfcb4c08808dfe93b28d45c52c989 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 f1b1dc38279ff51b86f04b94e0bf360815ab831a..9495dc1cfc8312ee32305ff9434bd26a458d41c2 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 33df065aaffe98423379c31ff4755b167e9ad517..2bbe0c57f88536c4581b2c11d17a8078b2a8d092 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 0b4dda62045cb71531415c19515d58f3d05a7d67..e100ecd8d3543cdc5d6f0379193c5646c87972fa 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 5d4160e1f38963231dc63c36589da244c8c7713d..631295947246e60144184b35bf95d63dd94aa6bf 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 c9b0f6aea21672cb10525809e8994263ce43e914..34aa9e69e3280bae32e5e89d494cde9ea3e6742f 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 ce1e6210ab9d44ea75f54a0981d53c83622ee59e..9214b90f5379960844e8f8f638c857af6cc78a1a 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 f4c4e4e8ae30882f352bca71897d48d8a4547d29..2250e2a479257c8c298bbc85a3cac9a5012095d1 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 466f3939ccff7a70a3b9523e7067a2fe0a6358a1..4c360ea56fd8c0e3e9a931d1857d62984d9aabb7 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 7fccfb0b057acb8a0e3089a91de90725233e2b0b..20df0a7062c82ae39df0ddc9e0cebfda9c97025a 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 5a616af2c817b84b81b43d3a89ca11f065999998..5f355a86cc4ff97a396c63087da544c77521b738 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 4556bc1c70f7ca8c9668c6f53cb7802753d0ffed..f028d62f90b65935eeb4c646e2e9a9e024353ebf 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 16a951db361c715065fcd94da472738a2d8af141..8fade6b52c372b85258bbcf9fdc673275141fdcc 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 5e3bbc6d1f7a4fd311df333b2b8b21c7ba1d1412..093cc6be3f6adea33ade325d2a40a260eda3a357 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 237ceadd5ee854f516d5d6483cafe0ca02f99abf..9d3ccb2c8e88bf880afeb4b504342cc3802edcb9 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 d5da9a254898b0306fdbcd0d91a14ea6fe70094a..66bceb6703cab18bf649273d3ceef2fba2cf077a 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 f84d639835334a30a8e19bcf51e627f78a823b4d..98c55a3c22a09c7d2f8148895a331b33610b8322 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 2c5fceffbd11b61fbb1c5c1f3d6e486086bdabef..aa759feb5612166a3c39b9519f166cd7da136645 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 154bfef851e2d3d55570037b7dce35841a508f56..3cbbcf8a52a862a0736e5f0a694b117ee4c9dfef 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 0c361b53b98aa22d48542fb94888515915fc9460..f214a294738ad15c7c6dab80cef32facefc5b600 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 daf57584765892879423ec486a95e32b98213a8b..ccc09d96320a3b1a3fe8ae53e3c3cf30d3152541 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 642be1f800c8459981c19180688b660fe7712d4f..ac15474dde018dde96a75f64aa64d005446b20ff 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 93e84f3bfa45f18e5997a7092390f2098480c2d9..1ed51854d8d8805f88411564f4ffde41f03422f1 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 d22541d4afa206cc5dae00f678473064856b7b58..5961840a97d09013de14a017776b2a3402705d4a 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 44d7cbb3e703e23e4a3016955cfa7917e5db736a..a54492bc22883d69a8f2ff43fe9f358d1a03e214 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 53a16a0371ccbe9834f75f59fd782bd3e6ec7eec..4a60f98b83a083cf32c87f69d3b6e695a3ab99fa 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 69842d675e46fc131912247f74b364be28027100..48dfa4e9a838077d4770e6afedb5874443a3f66b 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 380b750d454a93cfa8fdb11c17a65008a7c1525c..2cd73624bc399c5d2abdd4ec464cc66666623cd1 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', () => {