Skip to content
Snippets Groups Projects
Commit 14cf4399 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Update tests

parent b9298d00
No related branches found
No related tags found
3 merge requests!549chore(release): 1.7.1,!5211.7.0,!504feat/649-new-ecogestures-categorization
Showing
with 3712 additions and 44 deletions
/* eslint-disable react/display-name */
import React from 'react'
import { mount } from 'enzyme'
import toJson from 'enzyme-to-json'
import configureStore from 'redux-mock-store'
import { globalStateData } from '../../../../tests/__mocks__/globalStateData.mock'
import { Provider } from 'react-redux'
import ErrorPage from './ErrorPage'
import { Button } from '@material-ui/core'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
const mockHistoryPush = jest.fn()
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: () => ({
push: mockHistoryPush,
}),
}))
jest.mock('components/Header/Header', () => () => <div id="Header"></div>)
jest.mock('components/Header/CozyBar', () => () => <div id="CozyBar"></div>)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jest.mock('components/Content/Content', () => (props: any) => (
<div id="content">{props.children}</div>
))
const mockStore = configureStore([])
describe('ErrorPage component', () => {
it('should be rendered correctly', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
},
})
const wrapper = mount(
<Provider store={store}>
<ErrorPage text={'test'} returnPage={'ecogestures'} />
</Provider>
)
expect(toJson(wrapper)).toMatchSnapshot()
})
it('should click on button and be redirected', () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
},
})
const wrapper = mount(
<Provider store={store}>
<ErrorPage text={'test'} returnPage={'ecogestures'} />
</Provider>
)
wrapper.find(Button).simulate('click')
expect(mockHistoryPush).toHaveBeenCalledWith('/ecogestures')
})
})
......@@ -5,7 +5,7 @@ import CozyBar from 'components/Header/CozyBar'
import Header from 'components/Header/Header'
import BearIcon from 'assets/icons/visu/duelResult/CHALLENGE0001-0.svg'
import { Button } from '@material-ui/core'
import { useHistory } from 'react-router'
import { useHistory } from 'react-router-dom'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
import './errorPage.scss'
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ErrorPage component should be rendered correctly 1`] = `
<Provider
store={
Object {
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
}
}
>
<ErrorPage
returnPage="ecogestures"
text="test"
>
<Component
titleKey="error_page.main"
>
<div
id="CozyBar"
/>
</Component>
<Component
desktopTitleKey="error_page.main"
setHeaderHeight={[Function]}
>
<div
id="Header"
/>
</Component>
<Component
height={0}
>
<div
id="content"
>
<div
className="error-container"
>
<StyledIcon
className="profile-icon"
icon="test-file-stub"
size={250}
>
<Icon
aria-hidden={true}
className="profile-icon"
icon="test-file-stub"
size={250}
spin={false}
>
<Component
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))
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 {
"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"
>
<WithStyles(ForwardRef(ButtonBase))
aria-label="error_page.back"
className="MuiButton-root btn-highlight MuiButton-contained"
component="button"
disabled={false}
focusRipple={true}
focusVisibleClassName="Mui-focusVisible"
onClick={[Function]}
type="submit"
>
<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}
focusVisibleClassName="Mui-focusVisible"
onClick={[Function]}
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"
>
error_page.back
</span>
<NoSsr>
<WithStyles(memo)
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",
}
}
>
<span
className="MuiTouchRipple-root"
>
<TransitionGroup
childFactory={[Function]}
component={null}
exit={true}
/>
</span>
</ForwardRef(TouchRipple)>
</WithStyles(memo)>
</NoSsr>
</button>
</ForwardRef(ButtonBase)>
</WithStyles(ForwardRef(ButtonBase))>
</ForwardRef(Button)>
</WithStyles(ForwardRef(Button))>
</div>
</div>
</Component>
</ErrorPage>
</Provider>
`;
/* eslint-disable react/display-name */
import React from 'react'
import { shallow } from 'enzyme'
import { mount } from 'enzyme'
import EcogestureCard from 'components/Ecogesture/EcogestureCard'
import { ecogesturesData } from '../../../tests/__mocks__/ecogesturesData.mock'
import toJson from 'enzyme-to-json'
import configureStore from 'redux-mock-store'
import { globalStateData } from '../../../tests/__mocks__/globalStateData.mock'
import { Provider } from 'react-redux'
import { BrowserRouter } from 'react-router-dom'
import { act } from 'react-dom/test-utils'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
......@@ -12,6 +19,9 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => {
}),
}
})
jest.mock('components/CommonKit/Icon/StyledIcon', () => () => (
<div id="StyledIcon"></div>
))
const mockImportIconbyId = jest.fn()
jest.mock('utils/utils', () => {
return {
......@@ -21,11 +31,47 @@ jest.mock('utils/utils', () => {
}
})
const mockStore = configureStore([])
describe('EcogestureCard component', () => {
it('should be rendered correctly', () => {
const component = shallow(
<EcogestureCard ecogesture={ecogesturesData[0]} />
).getElement
expect(component).toMatchSnapshot()
it('should be rendered correctly', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
},
})
mockImportIconbyId.mockReturnValue('')
const wrapper = mount(
<Provider store={store}>
<BrowserRouter>
<EcogestureCard ecogesture={ecogesturesData[0]} />
</BrowserRouter>
</Provider>
)
await act(async () => {
await new Promise(resolve => setTimeout(resolve))
wrapper.update()
})
expect(toJson(wrapper)).toMatchSnapshot()
})
it('should be with default icon', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
},
})
mockImportIconbyId.mockReturnValue(null)
const wrapper = mount(
<Provider store={store}>
<BrowserRouter>
<EcogestureCard ecogesture={ecogesturesData[0]} />
</BrowserRouter>
</Provider>
)
await act(async () => {
await new Promise(resolve => setTimeout(resolve))
wrapper.update()
})
expect(wrapper.find('.Icon').exists()).toBeTruthy()
})
})
......@@ -2,6 +2,7 @@ import React from 'react'
import { mount } from 'enzyme'
import EcogestureInfoModal from './EcogestureInfoModal'
import Button from '@material-ui/core/Button'
import toJson from 'enzyme-to-json'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
......@@ -23,6 +24,7 @@ describe('EcogestureInfoModal component', () => {
handleCloseClick={mockHandleCloseClick}
/>
)
expect(toJson(wrapper)).toMatchSnapshot()
expect(wrapper.find('.info-header').exists()).toBeTruthy()
expect(wrapper.find('.info-title').exists()).toBeTruthy()
expect(wrapper.find('.info-detail').exists()).toBeTruthy()
......
import React from 'react'
import { shallow } from 'enzyme'
import { mount } from 'enzyme'
import EcogestureList from 'components/Ecogesture/EcogestureList'
import toJson from 'enzyme-to-json'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
import { challengeStateData } from '../../../tests/__mocks__/challengeStateData.mock'
import { globalStateData } from '../../../tests/__mocks__/globalStateData.mock'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
......@@ -11,11 +16,21 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => {
}),
}
})
const mockStore = configureStore([])
describe('EcogesturesList component', () => {
it('should be rendered correctly', () => {
const component = shallow(<EcogestureList filteredByProfile={false} />)
.getElement
expect(component).toMatchSnapshot()
const store = mockStore({
ecolyo: {
global: globalStateData,
challenge: challengeStateData,
},
})
const wrapper = mount(
<Provider store={store}>
<EcogestureList filteredByProfile={false} />
</Provider>
)
expect(toJson(wrapper)).toMatchSnapshot()
})
})
import React from 'react'
import { shallow } from 'enzyme'
import { mount } from 'enzyme'
import EfficientyRating from 'components/Ecogesture/EfficientyRating'
import toJson from 'enzyme-to-json'
import { Provider } from 'react-redux'
import configureStore from 'redux-mock-store'
import { challengeStateData } from '../../../tests/__mocks__/challengeStateData.mock'
import { globalStateData } from '../../../tests/__mocks__/globalStateData.mock'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
......@@ -12,9 +17,21 @@ jest.mock('cozy-ui/transpiled/react/I18n', () => {
}
})
const mockStore = configureStore([])
describe('EfficientyRating component', () => {
it('should be rendered correctly', () => {
const component = shallow(<EfficientyRating result={3} />).getElement
expect(component).toMatchSnapshot()
const store = mockStore({
ecolyo: {
global: globalStateData,
challenge: challengeStateData,
},
})
const wrapper = mount(
<Provider store={store}>
<EfficientyRating result={3} />
</Provider>
)
expect(toJson(wrapper)).toMatchSnapshot()
})
})
/* eslint-disable react/display-name */
import React from 'react'
import { mount } from 'enzyme'
import { Provider } from 'react-redux'
import SingleEcogesture from 'components/Ecogesture/SingleEcogesture'
import toJson from 'enzyme-to-json'
import { act } from 'react-dom/test-utils'
import { challengeStateData } from '../../../tests/__mocks__/challengeStateData.mock'
import { ecogesturesData } from '../../../tests/__mocks__/ecogesturesData.mock'
import configureStore from 'redux-mock-store'
import { globalStateData } from '../../../tests/__mocks__/globalStateData.mock'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
const mockImportIconbyId = jest.fn()
jest.mock('utils/utils', () => {
return {
importIconbyId: () => mockImportIconbyId,
}
})
jest.mock('components/Ecogesture/EfficientyRating', () => () => (
<div id="EfficientyRating"></div>
))
jest.mock('components/Header/Header', () => () => <div id="Header"></div>)
jest.mock('components/Header/CozyBar', () => () => <div id="CozyBar"></div>)
jest.mock('components/CommonKit/Spinner/StyledSpinner', () => () => (
<div id="spinner"></div>
))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
jest.mock('components/Content/Content', () => (props: any) => (
<div id="content">{props.children}</div>
))
const mockgetEcogesturesByIds = jest.fn()
const mockupdateEcogesture = jest.fn()
jest.mock('services/ecogesture.service', () => {
return jest.fn(() => {
return {
getEcogesturesByIds: mockgetEcogesturesByIds,
updateEcogesture: mockupdateEcogesture,
}
})
})
const mockStore = configureStore([])
describe('SingleEcogesture component', () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
it('should be rendered correctly', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
challenge: challengeStateData,
},
})
mockgetEcogesturesByIds.mockResolvedValue([ecogesturesData[0]])
const wrapper = mount(
<Provider store={store}>
<SingleEcogesture match={{ params: { id: 'ECOGESTURE0001' } }} />
</Provider>
)
await act(async () => {
await new Promise(resolve => setTimeout(resolve))
wrapper.update()
})
expect(toJson(wrapper)).toMatchSnapshot()
})
it('should change doing status', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
challenge: challengeStateData,
},
})
mockgetEcogesturesByIds.mockResolvedValue([ecogesturesData[0]])
mockImportIconbyId.mockReturnValue('')
const updatedEcogesture = { ...ecogesturesData[0], doing: true }
const wrapper = mount(
<Provider store={store}>
<SingleEcogesture match={{ params: { id: 'ECOGESTURE0001' } }} />
</Provider>
)
await act(async () => {
await new Promise(resolve => setTimeout(resolve))
wrapper.update()
})
wrapper
.find('.doing-btn')
.first()
.simulate('click')
expect(mockupdateEcogesture).toHaveBeenCalledWith(updatedEcogesture)
})
it('should change objective status', async () => {
const store = mockStore({
ecolyo: {
global: globalStateData,
challenge: challengeStateData,
},
})
mockgetEcogesturesByIds.mockResolvedValue([ecogesturesData[0]])
mockImportIconbyId.mockReturnValue('icontest')
const updatedEcogesture = { ...ecogesturesData[0], objective: true }
const wrapper = mount(
<Provider store={store}>
<SingleEcogesture match={{ params: { id: 'ECOGESTURE0001' } }} />
</Provider>
)
await act(async () => {
await new Promise(resolve => setTimeout(resolve))
wrapper.update()
})
wrapper
.find('.objective-btn')
.first()
.simulate('click')
expect(mockupdateEcogesture).toHaveBeenCalledWith(updatedEcogesture)
})
})
......@@ -83,41 +83,41 @@ const SingleEcogesture: React.FC<SingleEcogestureProps> = ({
}, [ecogesture, ecogestureService, isDoing])
useEffect(() => {
setIsLoading(true)
let subscribed = true
async function getSingleEcogesture() {
const data = await ecogestureService.getEcogesturesByIds([ecogestureID])
if (data && data[0]) {
setEcogesture(data[0])
//Prevent case this key doesn't exist in doctype
setIsObjective(data[0].objective ? true : false)
setIsDoing(data[0].doing ? true : false)
}
}
async function handleEcogestureIcon() {
if (ecogesture) {
const icon = await importIconbyId(ecogesture.id, 'ecogesture')
if (icon) {
setEcogestureIcon(icon)
} else {
setEcogestureIcon(defaultIcon)
}
if (
currentChallenge &&
currentChallenge.exploration.ecogesture_id === ecogesture._id
) {
setValidExploration(currentChallenge.exploration.id)
if (subscribed) {
if (data && data[0]) {
setEcogesture(data[0])
//Prevent case this key doesn't exist in doctype
setIsObjective(data[0].objective ? true : false)
setIsDoing(data[0].doing ? true : false)
const icon = await importIconbyId(data[0].id, 'ecogesture')
if (subscribed) {
if (icon) {
setEcogestureIcon(icon)
} else {
setEcogestureIcon(defaultIcon)
}
if (
currentChallenge &&
currentChallenge.exploration.ecogesture_id === data[0]._id
) {
setValidExploration(currentChallenge.exploration.id)
}
}
}
setIsLoading(false)
}
}
getSingleEcogesture()
.then(() => handleEcogestureIcon())
.finally(() => {
setIsLoading(false)
})
return () => {
subscribed = false
}
}, [
client,
currentChallenge,
ecogesture,
ecogestureID,
ecogestureService,
setValidExploration,
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`EfficientyRating component should be rendered correctly 1`] = `[Function]`;
exports[`EfficientyRating component should be rendered correctly 1`] = `
<Provider
store={
Object {
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
}
}
>
<EfficientyRating
result={3}
>
<div
className="thunder"
>
<StyledIcon
className="star"
icon="test-file-stub"
key="0"
size={15}
>
<Icon
aria-hidden={true}
className="star"
icon="test-file-stub"
size={15}
spin={false}
>
<Component
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<svg
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
<StyledIcon
className="star"
icon="test-file-stub"
key="1"
size={15}
>
<Icon
aria-hidden={true}
className="star"
icon="test-file-stub"
size={15}
spin={false}
>
<Component
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<svg
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
<StyledIcon
className="star"
icon="test-file-stub"
key="2"
size={15}
>
<Icon
aria-hidden={true}
className="star"
icon="test-file-stub"
size={15}
spin={false}
>
<Component
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<svg
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
<StyledIcon
className="star"
icon="test-file-stub"
key="3"
size={15}
>
<Icon
aria-hidden={true}
className="star"
icon="test-file-stub"
size={15}
spin={false}
>
<Component
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<svg
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
<StyledIcon
className="star"
icon="test-file-stub"
key="4"
size={15}
>
<Icon
aria-hidden={true}
className="star"
icon="test-file-stub"
size={15}
spin={false}
>
<Component
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<svg
aria-hidden={true}
className="star styles__icon___23x3R"
height={15}
style={Object {}}
width={15}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
</StyledIcon>
</div>
</EfficientyRating>
</Provider>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SingleEcogesture component should be rendered correctly 1`] = `
<Provider
store={
Object {
"clearActions": [Function],
"dispatch": [Function],
"getActions": [Function],
"getState": [Function],
"replaceReducer": [Function],
"subscribe": [Function],
}
}
>
<SingleEcogesture
match={
Object {
"params": Object {
"id": "ECOGESTURE0001",
},
}
}
>
<Component
displayBackArrow={true}
isNotKey={true}
titleKey="Bonhomme de neige"
>
<div
id="CozyBar"
/>
</Component>
<Component
desktopTitleKey="Bonhomme de neige"
displayBackArrow={true}
isNotKey={true}
setHeaderHeight={[Function]}
>
<div
id="Header"
/>
</Component>
<Component
height={0}
>
<div
id="content"
>
<div
className="single-ecogesture"
>
<div
className="icon-container"
/>
<div
className="details"
>
<div
className="efficiency"
>
<span
className="text text-14-normal"
>
ecogesture_modal.efficiency
</span>
<Component
result={4}
>
<div
id="EfficientyRating"
/>
</Component>
</div>
</div>
<div
className="styled-container"
>
<div
className="long-name"
>
Je baisse le chauffage en mode hors gel lorsque je m'absente plus de 2 jours.
</div>
<div
className="description text-16-normal-150"
>
On se demande parfois si cela vaut le coup de "couper le chauffage" quand on s’absente… dès qu’il s’agit d’un week-end la réponse est « oui sûrement » ! Attention cependant au retour à ne pas faire de la surchauffe ! L’idéal est bien évidemment de régler sa programmation pour que le chauffage se relance quelques heures avant votre retour…
</div>
<div
className="toggle-text text-15-normal"
onClick={[Function]}
>
ecogesture_modal.show_more
</div>
</div>
<div
className="buttons-selection"
>
<WithStyles(ForwardRef(IconButton))
aria-label="ecogesture.objective"
classes={
Object {
"label": "text-15-normal",
"root": "btn-secondary-negative objective-btn false",
}
}
onClick={[Function]}
>
<ForwardRef(IconButton)
aria-label="ecogesture.objective"
classes={
Object {
"colorInherit": "MuiIconButton-colorInherit",
"colorPrimary": "MuiIconButton-colorPrimary",
"colorSecondary": "MuiIconButton-colorSecondary",
"disabled": "Mui-disabled",
"edgeEnd": "MuiIconButton-edgeEnd",
"edgeStart": "MuiIconButton-edgeStart",
"label": "MuiIconButton-label text-15-normal",
"root": "MuiIconButton-root btn-secondary-negative objective-btn false",
"sizeSmall": "MuiIconButton-sizeSmall",
}
}
onClick={[Function]}
>
<WithStyles(ForwardRef(ButtonBase))
aria-label="ecogesture.objective"
centerRipple={true}
className="MuiIconButton-root btn-secondary-negative objective-btn false"
disabled={false}
focusRipple={true}
onClick={[Function]}
>
<ForwardRef(ButtonBase)
aria-label="ecogesture.objective"
centerRipple={true}
className="MuiIconButton-root btn-secondary-negative objective-btn false"
classes={
Object {
"disabled": "Mui-disabled",
"focusVisible": "Mui-focusVisible",
"root": "MuiButtonBase-root",
}
}
disabled={false}
focusRipple={true}
onClick={[Function]}
>
<button
aria-label="ecogesture.objective"
className="MuiButtonBase-root MuiIconButton-root btn-secondary-negative objective-btn false"
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="button"
>
<span
className="MuiIconButton-label text-15-normal"
>
<Icon
className="status-icon"
icon="test-file-stub"
size={40}
spin={false}
>
<Component
className="status-icon styles__icon___23x3R"
height={40}
style={Object {}}
width={40}
>
<svg
className="status-icon styles__icon___23x3R"
height={40}
style={Object {}}
width={40}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
<span>
ecogesture.objective
</span>
</span>
<NoSsr>
<WithStyles(memo)
center={true}
>
<ForwardRef(TouchRipple)
center={true}
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"
>
<TransitionGroup
childFactory={[Function]}
component={null}
exit={true}
/>
</span>
</ForwardRef(TouchRipple)>
</WithStyles(memo)>
</NoSsr>
</button>
</ForwardRef(ButtonBase)>
</WithStyles(ForwardRef(ButtonBase))>
</ForwardRef(IconButton)>
</WithStyles(ForwardRef(IconButton))>
<WithStyles(ForwardRef(IconButton))
aria-label="ecogesture.doing"
classes={
Object {
"label": "text-15-normal",
"root": "btn-secondary-negative doing-btn false",
}
}
onClick={[Function]}
>
<ForwardRef(IconButton)
aria-label="ecogesture.doing"
classes={
Object {
"colorInherit": "MuiIconButton-colorInherit",
"colorPrimary": "MuiIconButton-colorPrimary",
"colorSecondary": "MuiIconButton-colorSecondary",
"disabled": "Mui-disabled",
"edgeEnd": "MuiIconButton-edgeEnd",
"edgeStart": "MuiIconButton-edgeStart",
"label": "MuiIconButton-label text-15-normal",
"root": "MuiIconButton-root btn-secondary-negative doing-btn false",
"sizeSmall": "MuiIconButton-sizeSmall",
}
}
onClick={[Function]}
>
<WithStyles(ForwardRef(ButtonBase))
aria-label="ecogesture.doing"
centerRipple={true}
className="MuiIconButton-root btn-secondary-negative doing-btn false"
disabled={false}
focusRipple={true}
onClick={[Function]}
>
<ForwardRef(ButtonBase)
aria-label="ecogesture.doing"
centerRipple={true}
className="MuiIconButton-root btn-secondary-negative doing-btn false"
classes={
Object {
"disabled": "Mui-disabled",
"focusVisible": "Mui-focusVisible",
"root": "MuiButtonBase-root",
}
}
disabled={false}
focusRipple={true}
onClick={[Function]}
>
<button
aria-label="ecogesture.doing"
className="MuiButtonBase-root MuiIconButton-root btn-secondary-negative doing-btn false"
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="button"
>
<span
className="MuiIconButton-label text-15-normal"
>
<Icon
className="status-icon"
icon="test-file-stub"
size={40}
spin={false}
>
<Component
className="status-icon styles__icon___23x3R"
height={40}
style={Object {}}
width={40}
>
<svg
className="status-icon styles__icon___23x3R"
height={40}
style={Object {}}
width={40}
>
<use
xlinkHref="#test-file-stub"
/>
</svg>
</Component>
</Icon>
<span>
ecogesture.doing
</span>
</span>
<NoSsr>
<WithStyles(memo)
center={true}
>
<ForwardRef(TouchRipple)
center={true}
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"
>
<TransitionGroup
childFactory={[Function]}
component={null}
exit={true}
/>
</span>
</ForwardRef(TouchRipple)>
</WithStyles(memo)>
</NoSsr>
</button>
</ForwardRef(ButtonBase)>
</WithStyles(ForwardRef(ButtonBase))>
</ForwardRef(IconButton)>
</WithStyles(ForwardRef(IconButton))>
</div>
</div>
</div>
</Component>
</SingleEcogesture>
</Provider>
`;
......@@ -249,4 +249,16 @@ describe('Ecogesture service', () => {
})
})
})
it('should update an ecogesture', async () => {
const mockQueryResult: QueryResult<Ecogesture> = {
data: ecogesturesData[0],
bookmark: '',
next: false,
skip: 0,
}
mockClient.save.mockResolvedValueOnce(mockQueryResult)
const result = await ecogestureService.updateEcogesture(ecogesturesData[0])
expect(result).toEqual(ecogesturesData[0])
})
})
......@@ -5,7 +5,7 @@ describe('hash utilis test', () => {
describe('hashFile test', () => {
it('should return the correct hash of the file', () => {
const result = hashFile(ecogesturesData)
expect(result).toBe('8360d4805f19a732e6b43a41f972c324c8e06488')
expect(result).toBe('18e0ab48244aa3aad6ff70ffb972ac76fda315f4')
})
})
})
Stack trace:
Frame Function Args
000FFFFBF48 001800647D1 (000FFFFC168, 00000000002, 000FFFFCE00, 000FFFFDE50)
000FFFFBFF0 00180066C00 (00000000064, 00000000000, 000000001CC, 00000000000)
000FFFFC670 0018014B818 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFC840 001801761C9 (0018014D79F, 00000000173, 001802663DF, 000FFFFC910)
000FFFFC880 0018021A31C (00100492520, 00100492542, 00000000173, 001802663DF)
000FFFFC910 001800435DA (00000000000, 00800054708, 0080005470B, 00000064AB0)
000FFFFC960 00100402A2D (000FFFFCB10, 00800012F80, 000006B6750, 00100000003)
000FFFFC9F0 00100403892 (000FFFFCC60, 001803543B8, 000FFFFCDF0, 00000000000)
000FFFFCCE0 0018004B0FB (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFCDA0 00180048A2A (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFCE50 00180048AEC (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment