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

Add Card tests + improve import icon function + fixed syntax errors in models

parent 14b8b895
Branches
Tags
1 merge request!142Features/new challenges
Showing
with 511 additions and 173 deletions
...@@ -4,9 +4,9 @@ const axios = require('axios') ...@@ -4,9 +4,9 @@ const axios = require('axios')
const headers = { const headers = {
Accept: 'application/json', Accept: 'application/json',
Authorization: Authorization:
'Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhcHAiLCJpYXQiOjE2MDU2MDY0MTAsImlzcyI6ImNvenkudG9vbHM6ODA4MCIsInN1YiI6ImVjb2x5byIsInNlc3Npb25faWQiOiJmNDIzY2QyZmVjYWRjZDIyYTI5NGY3YmUwZDBkNjRiMCJ9.liI8LAvLmG6baEK2PXWJgO4ayegJiJP8TEtJzFZ4WRR4uFSepPsfv1HUgUqi2Scs50Jv4ODEfFbKk2Gtt3yBqQ', 'Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhcHAiLCJpYXQiOjE2MDY5OTU1OTgsImlzcyI6ImNvenkudG9vbHM6ODA4MCIsInN1YiI6ImVjb2x5byIsInNlc3Npb25faWQiOiI5ODI3ZmVlMjc5MDNmN2U2MGRmNjUwMThjZjAwOTk1ZiJ9.epzyD0QWnP5LHTXgEFaKLAGyrtDT0gjFzW6bQFsoLu2YFYN1ZVLyhz4vF5gTHZoaIwHETCXShnpwQiAICwtU8w',
Cookie: Cookie:
'cozysessid=AAAAAF79l4xmNDIzY2QyZmVjYWRjZDIyYTI5NGY3YmUwZDBkNjRiMEhQrejeDWaoYxUl8JN9VEVj7gPWBFc-CUykQ4Jw1vjz', 'cozysessid=AAAAAF_Izko5ODI3ZmVlMjc5MDNmN2U2MGRmNjUwMThjZjAwOTk1Zo-CT2_orrO4wnc6rr-gk-V_8gYax1xpEJmZpStKuADY',
'content-type': 'application/json', 'content-type': 'application/json',
} }
......
...@@ -14,7 +14,6 @@ const secondaryColor = window ...@@ -14,7 +14,6 @@ const secondaryColor = window
.getComputedStyle(document.documentElement) .getComputedStyle(document.documentElement)
.getPropertyValue('--greyDark') .getPropertyValue('--greyDark')
.trim() .trim()
const theme = createMuiTheme({ const theme = createMuiTheme({
typography: { typography: {
useNextVariants: true, useNextVariants: true,
......
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import { Ecogesture } from 'models' import { Ecogesture } from 'models'
import StyledEcogestureCard from 'components/CommonKit/Card/StyledEcogestureCard' import StyledEcogestureCard from 'components/CommonKit/Card/StyledEcogestureCard'
import def from 'assets/icons/visu/ecogesture/default.svg' import defaultIcon from 'assets/icons/visu/ecogesture/default.svg'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import { importIconbyId } from 'utils/utils'
interface EcogestureCardProps { interface EcogestureCardProps {
ecogesture: Ecogesture ecogesture: Ecogesture
...@@ -17,25 +18,15 @@ const EcogestureCard: React.FC<EcogestureCardProps> = ({ ...@@ -17,25 +18,15 @@ const EcogestureCard: React.FC<EcogestureCardProps> = ({
const handleCardclick = () => { const handleCardclick = () => {
handleClick && ecogesture && handleClick(ecogesture) handleClick && ecogesture && handleClick(ecogesture)
} }
const [ecogestureIcon, setEcogestureIcon] = useState(def) const [ecogestureIcon, setEcogestureIcon] = useState(defaultIcon)
async function importEcogestureIcon(id: string) {
// Les svg doivent être au format id.svg
let importedEcogesture
try {
importedEcogesture = await import(
/* webpackMode: "eager" */ `assets/icons/visu/ecogesture/${id}.svg`
)
} catch (e) {}
if (importedEcogesture) {
setEcogestureIcon(importedEcogesture.default)
}
}
useEffect(() => { useEffect(() => {
if (ecogesture) { if (ecogesture) {
importEcogestureIcon(ecogesture.id) importIconbyId(ecogesture.id, 'ecogesture').then(icon => {
icon && setEcogestureIcon(icon)
})
} }
}, []) }, [ecogesture])
return ( return (
<> <>
......
...@@ -6,7 +6,8 @@ import { Ecogesture } from 'models' ...@@ -6,7 +6,8 @@ import { Ecogesture } from 'models'
import Modal from 'components/CommonKit/Modal/Modal' import Modal from 'components/CommonKit/Modal/Modal'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import def from 'assets/icons/visu/ecogesture/default.svg' import defaultIcon from 'assets/icons/visu/ecogesture/default.svg'
import { importIconbyId } from 'utils/utils'
interface EcogestureModalProps { interface EcogestureModalProps {
open: boolean open: boolean
...@@ -20,24 +21,13 @@ const EcogestureModal: React.FC<EcogestureModalProps> = ({ ...@@ -20,24 +21,13 @@ const EcogestureModal: React.FC<EcogestureModalProps> = ({
handleCloseClick, handleCloseClick,
}: EcogestureModalProps) => { }: EcogestureModalProps) => {
const { t } = useI18n() const { t } = useI18n()
const [ecogestureIcon, setEcogestureIcon] = useState(def) const [ecogestureIcon, setEcogestureIcon] = useState(defaultIcon)
async function importEcogestureIcon(id: string) {
// Les svg doivent être au format id.svg
let importedEcogesture
try {
importedEcogesture = await import(
/* webpackMode: "eager" */ `assets/icons/visu/ecogesture/${id}.svg`
)
} catch (e) {}
if (importedEcogesture) {
setEcogestureIcon(importedEcogesture.default)
}
}
useEffect(() => { useEffect(() => {
if (ecogesture) { if (ecogesture) {
importEcogestureIcon(ecogesture.id) importIconbyId(ecogesture.id, 'ecogesture').then(icon => {
icon && setEcogestureIcon(icon)
})
} }
}, [ecogesture]) }, [ecogesture])
......
import React from 'react'
import { createMuiTheme } from '@material-ui/core'
import { MuiThemeProvider } from '@material-ui/core/styles'
function MockTheme({ children }: any) {
const theme = createMuiTheme({})
return <MuiThemeProvider theme={theme}>{children}</MuiThemeProvider>
}
export default MockTheme
import React from 'react'
import { shallow } from 'enzyme'
import SeasonCard from './SeasonCard'
import SeasonCardLocked from './SeasonCardLocked'
import SeasonCardUnlocked from './SeasonCardUnlocked'
import SeasonCardOnGoing from './SeasonCardOnGoing'
import { userSeasonData } from '../../../test/__mocks__/userSeasonData.mock'
import StyledButtonValid from 'components/CommonKit/Button/StyledButtonValid'
import MockTheme from './MockTheme'
import * as Style from '@material-ui/core/styles'
import { createMuiTheme } from '@material-ui/core/styles'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
jest.mock('@material-ui/core/styles/createMuiTheme', () => jest.fn())
// const mockTheme = createMuiTheme({})
// jest.spyOn(Style, 'createMuiTheme').mockReturnValue(mockTheme)
// const mockStyle = new CSSStyleDeclaration().setProperty('main', '#fff')
// jest.spyOn(window, 'getComputedStyle').mockReturnValue(mockStyle)
//TODO fis MUI theme error
describe('SeasonCard component', () => {
it('should be rendered correctly', () => {
// const mockStyle = new CSSStyleDeclaration()
// mockStyle.setProperty('color', '#fff')
// console.log('prop', mockStyle.getPropertyValue('color'))
// jest.spyOn(window, 'getComputedStyle').mockReturnValue(mockStyle)
const component = shallow(
<SeasonCard
userSeason={userSeasonData[1]}
indexSlider={0}
index={0}
cardWidth={200}
cardHeight={400}
/>
).getElement()
expect(component).toMatchSnapshot()
})
it('should render locked Card', () => {
const wrapper = shallow(
<SeasonCard
userSeason={userSeasonData[1]}
indexSlider={0}
index={0}
cardWidth={200}
cardHeight={400}
/>
)
expect(wrapper.find(SeasonCardLocked).exists()).toBeTruthy()
})
it('should render unlocked Card', () => {
const wrapper = shallow(
<SeasonCard
userSeason={userSeasonData[0]}
indexSlider={0}
index={0}
cardWidth={200}
cardHeight={400}
/>
)
expect(wrapper.find(SeasonCardUnlocked).exists()).toBeTruthy()
})
it('should render ongoing Card', () => {
const wrapper = shallow(
<SeasonCard
userSeason={userSeasonData[2]}
indexSlider={0}
index={0}
cardWidth={200}
cardHeight={400}
/>
)
expect(wrapper.find(SeasonCardOnGoing).exists()).toBeTruthy()
})
})
...@@ -11,14 +11,14 @@ interface SeasonCardProps { ...@@ -11,14 +11,14 @@ interface SeasonCardProps {
userSeason: UserSeason userSeason: UserSeason
indexSlider: number indexSlider: number
index: number index: number
cardWitdh: number cardWidth: number
cardHeight: number cardHeight: number
} }
const SeasonCard: React.FC<SeasonCardProps> = ({ const SeasonCard: React.FC<SeasonCardProps> = ({
userSeason, userSeason,
indexSlider, indexSlider,
index, index,
cardWitdh, cardWidth,
cardHeight, cardHeight,
}: SeasonCardProps) => { }: SeasonCardProps) => {
const renderCard = useCallback( const renderCard = useCallback(
...@@ -43,8 +43,8 @@ const SeasonCard: React.FC<SeasonCardProps> = ({ ...@@ -43,8 +43,8 @@ const SeasonCard: React.FC<SeasonCardProps> = ({
<div <div
className={indexSlider === index ? 'slide active' : 'slide'} className={indexSlider === index ? 'slide active' : 'slide'}
style={{ style={{
minWidth: `${cardWitdh}px`, minWidth: `${cardWidth}px`,
maxWidth: `${cardWitdh}px`, maxWidth: `${cardWidth}px`,
height: `${cardHeight}px`, height: `${cardHeight}px`,
}} }}
> >
......
import React from 'react'
import { shallow } from 'enzyme'
import SeasonCardLocked from './SeasonCardLocked'
import { userSeasonData } from '../../../test/__mocks__/userSeasonData.mock'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
//TODO fis MUI theme error
describe('SeasonCardLocked component', () => {
it('should be rendered correctly', () => {
const component = shallow(
<SeasonCardLocked userSeason={userSeasonData[1]} />
).getElement()
expect(component).toMatchSnapshot()
})
})
...@@ -3,6 +3,7 @@ import './seasonCardLocked.scss' ...@@ -3,6 +3,7 @@ import './seasonCardLocked.scss'
import { UserSeason } from 'models' import { UserSeason } from 'models'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import seasonLockedIcon from 'assets/icons/visu/season/seasonLocked.svg' import seasonLockedIcon from 'assets/icons/visu/season/seasonLocked.svg'
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
interface SeasonCardLockedProps { interface SeasonCardLockedProps {
userSeason: UserSeason userSeason: UserSeason
...@@ -10,13 +11,15 @@ interface SeasonCardLockedProps { ...@@ -10,13 +11,15 @@ interface SeasonCardLockedProps {
const SeasonCardLocked: React.FC<SeasonCardLockedProps> = ({ const SeasonCardLocked: React.FC<SeasonCardLockedProps> = ({
userSeason, userSeason,
}: SeasonCardLockedProps) => { }: SeasonCardLockedProps) => {
const { t } = useI18n()
return ( return (
<div className="cardContent"> <div className="cardContent">
<p className="title">Saison</p> <p className="title">{t('season.card.title')}</p>
<span className="seasonTitle">{userSeason.title}</span> <span className="seasonTitle">{userSeason.title}</span>
<StyledIcon className="seasonIcon" icon={seasonLockedIcon} /> <StyledIcon className="seasonIcon" icon={seasonLockedIcon} />
<p className="toUnlock text-16-normal-150"> <p className="toUnlock text-16-normal-150">
À débloquer en terminant la saison précédente {t('season.card.locked.desc')}
</p> </p>
</div> </div>
) )
......
import React from 'react'
import { shallow } from 'enzyme'
import SeasonCardUnlocked from './SeasonCardUnlocked'
import { userSeasonData } from '../../../test/__mocks__/userSeasonData.mock'
import { globalStateData } from '../../../test/__mocks__/globalStateData.mock'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
const mockUseSelector = globalStateData
jest.mock('react-redux', () => ({
useSelector: jest.fn().mockResolvedValue(mockUseSelector),
useDispatch: () => jest.fn(),
}))
//TODO fis MUI theme error
describe('SeasonCardUnlocked component', () => {
it('should be rendered correctly', () => {
const component = shallow(
<SeasonCardUnlocked userSeason={userSeasonData[0]} />
).getElement()
expect(component).toMatchSnapshot()
})
it('should launch the season', () => {
const mocklaunchSeason = jest.fn()
const wrapper = shallow(
<SeasonCardUnlocked userSeason={userSeasonData[0]} />
)
wrapper.find('.launchButton').simulate('click')
expect(mocklaunchSeason).toBeCalledTimes(1)
})
// it('should open the fluid modal', () => {})
})
...@@ -11,6 +11,7 @@ import SeasonNoFluidModal from './SeasonNoFluidModal' ...@@ -11,6 +11,7 @@ import SeasonNoFluidModal from './SeasonNoFluidModal'
import { EcolyoState } from 'store' import { EcolyoState } from 'store'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon' import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import defaultIcon from 'assets/icons/visu/season/seasonLocked.svg' import defaultIcon from 'assets/icons/visu/season/seasonLocked.svg'
import { importIconbyId } from 'utils/utils'
interface SeasonCardUnlockedProps { interface SeasonCardUnlockedProps {
userSeason: UserSeason userSeason: UserSeason
...@@ -27,19 +28,6 @@ const SeasonCardUnlocked: React.FC<SeasonCardUnlockedProps> = ({ ...@@ -27,19 +28,6 @@ const SeasonCardUnlocked: React.FC<SeasonCardUnlockedProps> = ({
const [seasonIcon, setSeasonIcon] = useState(defaultIcon) const [seasonIcon, setSeasonIcon] = useState(defaultIcon)
const importSeasonIcon = useCallback(async (id: string) => {
// Les svg doivent être au format id.svg
let importedSeasonIcon
try {
importedSeasonIcon = await import(
/* webpackMode: "eager" */ `assets/icons/visu/season/${id}.svg`
)
} catch (e) {}
if (importedSeasonIcon) {
setSeasonIcon(importedSeasonIcon.default)
}
}, [])
const toggleNoFluidModal = useCallback(() => { const toggleNoFluidModal = useCallback(() => {
setopenNoFluidModal(prev => !prev) setopenNoFluidModal(prev => !prev)
}, []) }, [])
...@@ -56,9 +44,11 @@ const SeasonCardUnlocked: React.FC<SeasonCardUnlockedProps> = ({ ...@@ -56,9 +44,11 @@ const SeasonCardUnlocked: React.FC<SeasonCardUnlockedProps> = ({
useEffect(() => { useEffect(() => {
if (userSeason) { if (userSeason) {
importSeasonIcon(userSeason.id) importIconbyId(userSeason.id, 'season').then(icon => {
icon && setSeasonIcon(icon)
})
} }
}, [userSeason, importSeasonIcon]) }, [userSeason])
return ( return (
<> <>
......
import React from 'react'
import { shallow } from 'enzyme'
import SeasonNoFluidModal from './SeasonNoFluidModal'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})
describe('SeasonNoFluidModal component', () => {
it('should be rendered correctly opened', () => {
const handleClose = jest.fn()
const component = shallow(
<SeasonNoFluidModal open={true} handleCloseClick={handleClose} />
).getElement()
expect(component).toMatchSnapshot()
})
it('should be rendered correctly closed', () => {
const handleClose = jest.fn()
const component = shallow(
<SeasonNoFluidModal open={false} handleCloseClick={handleClose} />
).getElement()
expect(component).toMatchSnapshot()
})
})
import React from 'react' import React from 'react'
import { shallow } from 'enzyme' import { shallow } from 'enzyme'
import SeasonView from 'components/Season/SeasonView' import SeasonView from 'components/Season/SeasonView'
import { seasonStateDataFull } from '../../../test/__mocks__/seasonStateData.mock'
const mockaHandleTouchStart = jest.fn() const mockaHandleTouchStart = jest.fn()
const mockaHandleTouchMove = jest.fn() const mockaHandleTouchMove = jest.fn()
const mockaHandleTouchEnd = jest.fn() const mockaHandleTouchEnd = jest.fn()
const mockUseSelector = seasonStateDataFull
jest.mock('react-redux', () => ({
useSelector: jest.fn().mockResolvedValue(mockUseSelector),
useDispatch: () => jest.fn(),
}))
describe('SeasonView component', () => { describe('SeasonView component', () => {
it('should be rendered correctly', () => { it('should be rendered correctly', () => {
const component = shallow(<SeasonView />).getElement() const component = shallow(<SeasonView />).getElement()
expect(component).toMatchSnapshot() expect(component).toMatchSnapshot()
}) })
it('should detect user swipe on slider', () => { // it('should detect user swipe on slider', () => {
const wrapper = shallow(<SeasonView />) // const wrapper = shallow(<SeasonView />)
// TODO how to simulate Touch event in jest // // TODO how to simulate Touch event in jest
wrapper.find('.seasonSlider').simulate('touchStart', { // wrapper.find('.seasonSlider').simulate('touchStart', {
targetTouches: [ // targetTouches: [
{ // {
clientX: 50, // clientX: 50,
}, // },
], // ],
}) // })
mockaHandleTouchStart.mockReturnValueOnce({ nativeEvent: '' }) // mockaHandleTouchStart.mockReturnValueOnce({ nativeEvent: '' })
expect(mockaHandleTouchStart).toBeCalledTimes(1) // expect(mockaHandleTouchStart).toBeCalledTimes(1)
}) // })
}) })
...@@ -89,7 +89,7 @@ const SeasonView: React.FC = () => { ...@@ -89,7 +89,7 @@ const SeasonView: React.FC = () => {
setTouchEnd(e.targetTouches[0].clientX) setTouchEnd(e.targetTouches[0].clientX)
if (e.nativeEvent instanceof MouseEvent) setTouchEnd(e.clientX) if (e.nativeEvent instanceof MouseEvent) setTouchEnd(e.clientX)
} }
console.log('userseasonlist', userSeasonList)
return ( return (
<> <>
<CozyBar titleKey={'COMMON.APP_CHALLENGE_TITLE'} /> <CozyBar titleKey={'COMMON.APP_CHALLENGE_TITLE'} />
...@@ -120,7 +120,7 @@ const SeasonView: React.FC = () => { ...@@ -120,7 +120,7 @@ const SeasonView: React.FC = () => {
userSeason={userSeason} userSeason={userSeason}
indexSlider={index} indexSlider={index}
index={i} index={i}
cardWitdh={cardWitdh} cardWidth={cardWitdh}
cardHeight={cardHeight} cardHeight={cardHeight}
/> />
))} ))}
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SeasonCard component should be rendered correctly 1`] = `
<div
className="slide active"
style={
Object {
"height": "400px",
"maxWidth": "200px",
"minWidth": "200px",
}
}
>
<SeasonCardLocked
userSeason={
Object {
"boss": Object {
"description": "Je parie un ours polaire que vous ne pouvez pas consommer moins que #CONSUMPTION € en 1 semaine",
"duration": "P30D",
"id": "BOSS001",
"startDate": null,
"state": 0,
"threshold": 1,
"title": "NicolasHublot",
"userConsumption": 0,
},
"description": "foobar",
"endingDate": null,
"id": "SEASON0002",
"progress": 0,
"quiz": null,
"startDate": null,
"state": 0,
"success": 0,
"target": 40,
"title": "Tata",
}
}
/>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SeasonCardLocked component should be rendered correctly 1`] = `
<div
className="cardContent"
>
<p
className="title"
>
season.card.title
</p>
<span
className="seasonTitle"
>
Tata
</span>
<StyledIcon
className="seasonIcon"
icon="test-file-stub"
/>
<p
className="toUnlock text-16-normal-150"
>
season.card.locked.desc
</p>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SeasonCardUnlocked component should be rendered correctly 1`] = `
<React.Fragment>
<div
className="cardContent"
>
<p
className="title"
>
season.card.title
</p>
<span
className="seasonTitle"
>
Nicolas Hublot
</span>
<StyledIcon
className="seasonIcon"
icon="test-file-stub"
/>
<StyledButtonValid
className="launchButton"
color="primary"
onClick={[Function]}
>
season.card.unlocked.launch
</StyledButtonValid>
</div>
<SeasonNoFluidModal
handleCloseClick={[Function]}
open={false}
/>
</React.Fragment>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SeasonNoFluidModal component should be rendered correctly closed 1`] = `
<React.Fragment>
<Modal
handleCloseClick={[MockFunction]}
open={false}
>
<div
className="noFluidModal"
>
<div
className="no-fluid-title"
>
season.noFluidModal.title
</div>
<div
className="no-fluid-content"
>
season.noFluidModal.content
</div>
<StyledStopButton
className="button-ok"
color="secondary"
onClick={[MockFunction]}
>
COMMON.MODAL_OK
</StyledStopButton>
</div>
</Modal>
</React.Fragment>
`;
exports[`SeasonNoFluidModal component should be rendered correctly opened 1`] = `
<React.Fragment>
<Modal
handleCloseClick={[MockFunction]}
open={true}
>
<div
className="noFluidModal"
>
<div
className="no-fluid-title"
>
season.noFluidModal.title
</div>
<div
className="no-fluid-content"
>
season.noFluidModal.content
</div>
<StyledStopButton
className="button-ok"
color="secondary"
onClick={[MockFunction]}
>
COMMON.MODAL_OK
</StyledStopButton>
</div>
</Modal>
</React.Fragment>
`;
...@@ -341,6 +341,9 @@ ...@@ -341,6 +341,9 @@
"mission": "Missions", "mission": "Missions",
"action": "Actions", "action": "Actions",
"duel": "Défi Final" "duel": "Défi Final"
},
"locked": {
"desc": "À débloquer en terminant la saison précédente"
} }
} }
}, },
......
...@@ -80,7 +80,7 @@ describe('Boss service', () => { ...@@ -80,7 +80,7 @@ describe('Boss service', () => {
...bossData, ...bossData,
state: UserBossState.ONGOING, state: UserBossState.ONGOING,
startDate: DateTime.fromISO('2020-10-01T00:00:00.000'), startDate: DateTime.fromISO('2020-10-01T00:00:00.000'),
treshold: 50, threshold: 50,
} }
expect(result).toEqual(mockUpdatedBoss) expect(result).toEqual(mockUpdatedBoss)
}) })
...@@ -91,7 +91,8 @@ describe('Boss service', () => { ...@@ -91,7 +91,8 @@ describe('Boss service', () => {
...bossEntity, ...bossEntity,
state: UserBossState.LOCKED, state: UserBossState.LOCKED,
startDate: null, startDate: null,
consumption: 0, threshold: 15,
userConsumption: 0,
} }
const result = bossService.formatToUserBoss(bossEntity) const result = bossService.formatToUserBoss(bossEntity)
...@@ -102,7 +103,7 @@ describe('Boss service', () => { ...@@ -102,7 +103,7 @@ describe('Boss service', () => {
it('should return the userBoss with an updated consumption', () => { it('should return the userBoss with an updated consumption', () => {
const mockUpdatedBoss: Boss = { const mockUpdatedBoss: Boss = {
...bossData, ...bossData,
consumption: 55, userConsumption: 55,
} }
const result = bossService.uptadeUserBossConsumption(bossData, 55) const result = bossService.uptadeUserBossConsumption(bossData, 55)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment