Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • web-et-numerique/factory/llle_project/ecolyo
1 result
Select Git revision
Show changes
Showing
with 157 additions and 336 deletions
......@@ -5,122 +5,128 @@ exports[`ErrorPage component should be rendered correctly 1`] = `
returnPage="ecogestures"
text="test"
>
<Component
<mock-cozybar
titleKey="error_page.main"
>
<div
id="CozyBar"
/>
</Component>
<Component
/>
<mock-header
desktopTitleKey="error_page.main"
setHeaderHeight={[Function]}
>
<div
id="Header"
/>
</Component>
<Component
/>
<mock-content
heightOffset={0}
>
<div
id="content"
className="error-container"
>
<div
className="error-container"
<StyledIcon
className="profile-icon"
icon="test-file-stub"
size={250}
>
<StyledIcon
<Icon
aria-hidden={true}
className="profile-icon"
icon="test-file-stub"
size={250}
spin={false}
>
<Icon
<Component
aria-hidden={true}
className="profile-icon"
icon="test-file-stub"
size={250}
spin={false}
className="profile-icon styles__icon___23x3R"
height={250}
style={Object {}}
width={250}
>
<Component
<svg
aria-hidden={true}
className="profile-icon styles__icon___23x3R"
height={250}
style={Object {}}
width={250}
>
<svg
aria-hidden={true}
className="profile-icon styles__icon___23x3R"
height={250}
style={Object {}}
width={250}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
<div
className="text-18-bold head"
>
test
</div>
<WithStyles(ForwardRef(Button))
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
<div
className="text-18-bold head"
>
test
</div>
<WithStyles(ForwardRef(Button))
aria-label="error_page.back"
classes={
Object {
"label": "text-18-bold",
"root": "btn-highlight",
}
}
onClick={[Function]}
type="submit"
variant="contained"
>
<ForwardRef(Button)
aria-label="error_page.back"
classes={
Object {
"label": "text-18-bold",
"root": "btn-highlight",
"colorInherit": "MuiButton-colorInherit",
"contained": "MuiButton-contained",
"containedPrimary": "MuiButton-containedPrimary",
"containedSecondary": "MuiButton-containedSecondary",
"containedSizeLarge": "MuiButton-containedSizeLarge",
"containedSizeSmall": "MuiButton-containedSizeSmall",
"disableElevation": "MuiButton-disableElevation",
"disabled": "Mui-disabled",
"endIcon": "MuiButton-endIcon",
"focusVisible": "Mui-focusVisible",
"fullWidth": "MuiButton-fullWidth",
"iconSizeLarge": "MuiButton-iconSizeLarge",
"iconSizeMedium": "MuiButton-iconSizeMedium",
"iconSizeSmall": "MuiButton-iconSizeSmall",
"label": "MuiButton-label text-18-bold",
"outlined": "MuiButton-outlined",
"outlinedPrimary": "MuiButton-outlinedPrimary",
"outlinedSecondary": "MuiButton-outlinedSecondary",
"outlinedSizeLarge": "MuiButton-outlinedSizeLarge",
"outlinedSizeSmall": "MuiButton-outlinedSizeSmall",
"root": "MuiButton-root btn-highlight",
"sizeLarge": "MuiButton-sizeLarge",
"sizeSmall": "MuiButton-sizeSmall",
"startIcon": "MuiButton-startIcon",
"text": "MuiButton-text",
"textPrimary": "MuiButton-textPrimary",
"textSecondary": "MuiButton-textSecondary",
"textSizeLarge": "MuiButton-textSizeLarge",
"textSizeSmall": "MuiButton-textSizeSmall",
}
}
onClick={[Function]}
type="submit"
variant="contained"
>
<ForwardRef(Button)
<WithStyles(ForwardRef(ButtonBase))
aria-label="error_page.back"
classes={
Object {
"colorInherit": "MuiButton-colorInherit",
"contained": "MuiButton-contained",
"containedPrimary": "MuiButton-containedPrimary",
"containedSecondary": "MuiButton-containedSecondary",
"containedSizeLarge": "MuiButton-containedSizeLarge",
"containedSizeSmall": "MuiButton-containedSizeSmall",
"disableElevation": "MuiButton-disableElevation",
"disabled": "Mui-disabled",
"endIcon": "MuiButton-endIcon",
"focusVisible": "Mui-focusVisible",
"fullWidth": "MuiButton-fullWidth",
"iconSizeLarge": "MuiButton-iconSizeLarge",
"iconSizeMedium": "MuiButton-iconSizeMedium",
"iconSizeSmall": "MuiButton-iconSizeSmall",
"label": "MuiButton-label text-18-bold",
"outlined": "MuiButton-outlined",
"outlinedPrimary": "MuiButton-outlinedPrimary",
"outlinedSecondary": "MuiButton-outlinedSecondary",
"outlinedSizeLarge": "MuiButton-outlinedSizeLarge",
"outlinedSizeSmall": "MuiButton-outlinedSizeSmall",
"root": "MuiButton-root btn-highlight",
"sizeLarge": "MuiButton-sizeLarge",
"sizeSmall": "MuiButton-sizeSmall",
"startIcon": "MuiButton-startIcon",
"text": "MuiButton-text",
"textPrimary": "MuiButton-textPrimary",
"textSecondary": "MuiButton-textSecondary",
"textSizeLarge": "MuiButton-textSizeLarge",
"textSizeSmall": "MuiButton-textSizeSmall",
}
}
className="MuiButton-root btn-highlight MuiButton-contained"
component="button"
disabled={false}
focusRipple={true}
focusVisibleClassName="Mui-focusVisible"
onClick={[Function]}
type="submit"
variant="contained"
>
<WithStyles(ForwardRef(ButtonBase))
<ForwardRef(ButtonBase)
aria-label="error_page.back"
className="MuiButton-root btn-highlight MuiButton-contained"
classes={
Object {
"disabled": "Mui-disabled",
"focusVisible": "Mui-focusVisible",
"root": "MuiButtonBase-root",
}
}
component="button"
disabled={false}
focusRipple={true}
......@@ -128,82 +134,64 @@ exports[`ErrorPage component should be rendered correctly 1`] = `
onClick={[Function]}
type="submit"
>
<ForwardRef(ButtonBase)
<button
aria-label="error_page.back"
className="MuiButton-root btn-highlight MuiButton-contained"
classes={
Object {
"disabled": "Mui-disabled",
"focusVisible": "Mui-focusVisible",
"root": "MuiButtonBase-root",
}
}
component="button"
className="MuiButtonBase-root MuiButton-root btn-highlight MuiButton-contained"
disabled={false}
focusRipple={true}
focusVisibleClassName="Mui-focusVisible"
onBlur={[Function]}
onClick={[Function]}
onDragLeave={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseDown={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
onTouchStart={[Function]}
tabIndex={0}
type="submit"
>
<button
aria-label="error_page.back"
className="MuiButtonBase-root MuiButton-root btn-highlight MuiButton-contained"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
onDragLeave={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseDown={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
onTouchStart={[Function]}
tabIndex={0}
type="submit"
<span
className="MuiButton-label text-18-bold"
>
<span
className="MuiButton-label text-18-bold"
>
error_page.back
</span>
<WithStyles(memo)
error_page.back
</span>
<WithStyles(memo)
center={false}
>
<ForwardRef(TouchRipple)
center={false}
>
<ForwardRef(TouchRipple)
center={false}
classes={
Object {
"child": "MuiTouchRipple-child",
"childLeaving": "MuiTouchRipple-childLeaving",
"childPulsate": "MuiTouchRipple-childPulsate",
"ripple": "MuiTouchRipple-ripple",
"ripplePulsate": "MuiTouchRipple-ripplePulsate",
"rippleVisible": "MuiTouchRipple-rippleVisible",
"root": "MuiTouchRipple-root",
}
classes={
Object {
"child": "MuiTouchRipple-child",
"childLeaving": "MuiTouchRipple-childLeaving",
"childPulsate": "MuiTouchRipple-childPulsate",
"ripple": "MuiTouchRipple-ripple",
"ripplePulsate": "MuiTouchRipple-ripplePulsate",
"rippleVisible": "MuiTouchRipple-rippleVisible",
"root": "MuiTouchRipple-root",
}
}
>
<span
className="MuiTouchRipple-root"
>
<span
className="MuiTouchRipple-root"
>
<TransitionGroup
childFactory={[Function]}
component={null}
exit={true}
/>
</span>
</ForwardRef(TouchRipple)>
</WithStyles(memo)>
</button>
</ForwardRef(ButtonBase)>
</WithStyles(ForwardRef(ButtonBase))>
</ForwardRef(Button)>
</WithStyles(ForwardRef(Button))>
</div>
<TransitionGroup
childFactory={[Function]}
component={null}
exit={true}
/>
</span>
</ForwardRef(TouchRipple)>
</WithStyles(memo)>
</button>
</ForwardRef(ButtonBase)>
</WithStyles(ForwardRef(ButtonBase))>
</ForwardRef(Button)>
</WithStyles(ForwardRef(Button))>
</div>
</Component>
</mock-content>
</ErrorPage>
`;
......@@ -6,33 +6,18 @@ import { Provider } from 'react-redux'
import { createMockEcolyoStore } from 'tests/__mocks__/store'
import FormNavigation from './FormNavigation'
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'),
useNavigate: () => mockedNavigate,
}))
describe('FormNavigation component', () => {
const store = createMockEcolyoStore()
beforeEach(() => {
store.clearActions()
})
it('should be rendered correctly', () => {
const mockhandlePrevious = jest.fn()
const mockhandleNext = jest.fn()
const mockHandlePrevious = jest.fn()
const mockHandleNext = jest.fn()
const wrapper = mount(
<Provider store={store}>
<FormNavigation
step={ProfileTypeStepForm.COOKING_FLUID}
handlePrevious={mockhandlePrevious}
handleNext={mockhandleNext}
handlePrevious={mockHandlePrevious}
handleNext={mockHandleNext}
disableNextButton={false}
/>
</Provider>
......@@ -41,7 +26,7 @@ describe('FormNavigation component', () => {
wrapper.find(Button).at(1).simulate('click')
expect(wrapper.find('profile-navigation')).toBeTruthy()
expect(wrapper.find(Button)).toBeTruthy()
expect(mockhandlePrevious.mock.calls.length).toEqual(1)
expect(mockhandleNext.mock.calls.length).toEqual(1)
expect(mockHandlePrevious.mock.calls.length).toEqual(1)
expect(mockHandleNext.mock.calls.length).toEqual(1)
})
})
......@@ -6,28 +6,9 @@ import { Provider } from 'react-redux'
import { fluidStatusConnectedData } from 'tests/__mocks__/fluidStatusData.mock'
import { createMockEcolyoStore } from 'tests/__mocks__/store'
jest.mock('components/Connection/EPGLConnect/EpglInit', () => {
return jest.fn(() => {
return <div id="EpglInit" />
})
})
jest.mock('components/Connection/GRDFConnect/GrdfInit', () => {
return jest.fn(() => {
return <div id="GrdfInit" />
})
})
jest.mock('components/Connection/EPGLConnect/EpglInit', () => 'mock-EpglInit')
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'),
useNavigate: () => mockedNavigate,
}))
jest.mock('components/Connection/GRDFConnect/GrdfInit', () => 'mock-GrdfInit')
describe('Connection component test', () => {
const store = createMockEcolyoStore()
......
......@@ -9,11 +9,6 @@ import { fluidStatusConnectedData } from 'tests/__mocks__/fluidStatusData.mock'
import { createMockEcolyoStore } from 'tests/__mocks__/store'
import ExpiredConsentModal from './ExpiredConsentModal'
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'),
......@@ -26,8 +21,7 @@ const mockHandleCloseClick = jest.fn()
describe('ExpiredConsentModal component', () => {
const store = createMockEcolyoStore()
beforeEach(() => {
mockedNavigate.mockReset()
mockAppDispatch.mockClear()
jest.clearAllMocks()
})
it('should be rendered correctly', () => {
const component = mount(
......
......@@ -4,12 +4,6 @@ import toJson from 'enzyme-to-json'
import React from 'react'
import DeleteGRDFAccountModal from './DeleteGRDFAccountModal'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
describe('DeleteGRDFAccountModal component', () => {
it('should be rendered correctly', () => {
const component = mount(
......
......@@ -7,16 +7,6 @@ import * as storeHooks from 'store/hooks'
import { createMockEcolyoStore, mockGlobalState } from 'tests/__mocks__/store'
import SgeConnectView from './SgeConnectView'
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'),
useNavigate: () => mockedNavigate,
}))
jest.mock('components/Content/Content', () => 'mock-content')
jest.mock('components/Header/CozyBar', () => 'mock-cozybar')
......
......@@ -11,11 +11,6 @@ import { createMockEcolyoStore, mockGlobalState } from 'tests/__mocks__/store'
import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
import SgeInit from './SgeInit'
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'),
......
......@@ -5,12 +5,6 @@ import { Provider } from 'react-redux'
import { createMockEcolyoStore } from 'tests/__mocks__/store'
import SgeModalHint from './SgeModalHint'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
describe('SgeModalHint component', () => {
it('should be rendered correctly', () => {
const mockClose = jest.fn()
......
......@@ -5,11 +5,6 @@ import { Provider } from 'react-redux'
import { createMockEcolyoStore, mockGlobalState } from 'tests/__mocks__/store'
import StepAddress from './StepAddress'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
const mockHandleChange = jest.fn()
describe('StepAddress component', () => {
......
......@@ -5,11 +5,6 @@ import { Provider } from 'react-redux'
import { createMockEcolyoStore, mockGlobalState } from 'tests/__mocks__/store'
import StepConsent from './StepConsent'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
const mockHandleChange = jest.fn()
describe('StepConsent component', () => {
......
......@@ -5,11 +5,6 @@ import { Provider } from 'react-redux'
import { createMockEcolyoStore, mockGlobalState } from 'tests/__mocks__/store'
import StepIdentityAndPdl from './StepIdentityAndPdl'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
const mockHandleChange = jest.fn()
describe('StepIdentityAndPdl component', () => {
......
......@@ -447,7 +447,7 @@ exports[`Connection component test should call GrdfInit 1`] = `
<div
className="konnector-form"
>
<mockConstructor
<mock-GrdfInit
fluidStatus={
Object {
"connection": Object {
......@@ -473,11 +473,7 @@ exports[`Connection component test should call GrdfInit 1`] = `
}
}
onSuccess={[Function]}
>
<div
id="GrdfInit"
/>
</mockConstructor>
/>
</div>
</Connection>
</Provider>
......
......@@ -7,17 +7,9 @@ import { createMockEcolyoStore } from 'tests/__mocks__/store'
import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
import ConsumptionDetails from './ConsumptionDetails'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
describe('ConsumptionDetails component', () => {
const store = createMockEcolyoStore()
beforeEach(() => {
store.clearActions()
})
it('should be rendered correctly', async () => {
const wrapper = mount(
<Provider store={store}>
......
......@@ -18,24 +18,12 @@ import {
} from 'tests/__mocks__/store'
import ConsumptionView from './ConsumptionView'
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(() => {
return {
updateProfile: mockUpdateProfile,
}
})
return jest.fn(() => ({
updateProfile: mockUpdateProfile,
}))
})
const mockedNavigate = jest.fn()
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useNavigate: () => mockedNavigate,
}))
jest.mock('components/Header/CozyBar', () => 'mock-cozybar')
jest.mock('components/Header/Header', () => 'mock-header')
......@@ -77,12 +65,6 @@ mockFluidStatus[FluidType.ELECTRICITY].status = FluidState.DONE
const mockChartStateShowOffline = { ...mockChartState, showOfflineData: true }
describe('ConsumptionView component', () => {
const store = createMockEcolyoStore()
beforeEach(() => {
store.clearActions()
setCurrentTimeStepSpy.mockClear()
})
it('should be rendered correctly', async () => {
const store = createMockEcolyoStore({
chart: {
......
......@@ -9,22 +9,8 @@ import { createMockEcolyoStore, mockGlobalState } from 'tests/__mocks__/store'
import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
import FluidButton from './FluidButton'
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'),
useNavigate: () => mockedNavigate,
}))
describe('FluidButton component', () => {
const store = createMockEcolyoStore()
beforeEach(() => {
store.clearActions()
})
it('should be rendered correctly', async () => {
const wrapper = mount(
......
......@@ -7,22 +7,8 @@ import { createMockEcolyoStore } from 'tests/__mocks__/store'
import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
import FluidButtons from './FluidButtons'
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'),
useNavigate: () => mockedNavigate,
}))
describe('FluidButtons component', () => {
const store = createMockEcolyoStore()
beforeEach(() => {
store.clearActions()
})
it('should be rendered correctly', async () => {
const wrapper = mount(
......
......@@ -11,19 +11,11 @@ import { createMockEcolyoStore, mockChartState } from 'tests/__mocks__/store'
import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
import DataloadConsumptionVisualizer from './DataloadConsumptionVisualizer'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
const mockGetAllLastPrices = jest.fn()
jest.mock('services/fluidsPrices.service', () => {
return jest.fn(() => {
return {
getAllLastPrices: mockGetAllLastPrices,
}
})
return jest.fn(() => ({
getAllLastPrices: mockGetAllLastPrices,
}))
})
const mockChartStateLoaded = { ...mockChartState, loading: false }
......@@ -131,11 +123,9 @@ describe('Dataload consumption visualizer component', () => {
})
const mockLoadToEuro = jest.fn()
jest.mock('services/converter.service', () => {
return jest.fn(() => {
return {
LoadToEuro: mockLoadToEuro,
}
})
return jest.fn(() => ({
LoadToEuro: mockLoadToEuro,
}))
})
const wrapper = mount(
......
......@@ -6,11 +6,6 @@ import React from 'react'
import { baseDataLoad } from 'tests/__mocks__/chartData.mock'
import DataloadNoValue from './DataloadNoValue'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
const mockSetActive = jest.fn()
describe('DataloadNoValue component', () => {
......
......@@ -6,12 +6,6 @@ import React from 'react'
import { baseDataLoad } from 'tests/__mocks__/chartData.mock'
import DataloadSection from './DataloadSection'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
jest.mock(
'components/ConsumptionVisualizer/DataloadSectionValue',
() => 'mock-dataloadsectionvalue'
......
......@@ -6,12 +6,6 @@ import React from 'react'
import { baseDataLoad } from 'tests/__mocks__/chartData.mock'
import DataloadSectionDetail from './DataloadSectionDetail'
jest.mock('cozy-ui/transpiled/react/I18n', () => ({
useI18n: jest.fn(() => ({
t: (str: string) => str,
})),
}))
describe('DataloadSectionDetail component', () => {
const mockDataload: Dataload = baseDataLoad
......