Skip to content
Snippets Groups Projects
Commit 1baf26ac authored by HAUTBOIS Aurelie's avatar HAUTBOIS Aurelie
Browse files

feat: update test with profileType

parent 85a1f3ae
No related branches found
No related tags found
1 merge request!218features/US277-profile_type_models_enums
......@@ -26,5 +26,5 @@ export interface Profile
haveSeenOldFluidModal: DateTime | boolean
monthlyReportDate: DateTime
profileType: ProfileType
isProfileCompleted: boolean
isProfileTypeCompleted: boolean
}
......@@ -2,6 +2,16 @@ import { Client, Q, QueryDefinition, QueryResult } from 'cozy-client'
import { Profile, ProfileEntity } from 'models'
import { PROFILE_DOCTYPE } from 'doctypes'
import { DateTime } from 'luxon'
import {
ConstructionYear,
FacilitiesInstallation,
Floor,
Heating,
HotWaterEquipment,
HousingType,
IndividualInsulationWork,
} from 'enum/profileType.enum'
import { FluidType } from 'enum/fluid.enum'
export default class ProfileService {
private readonly _client: Client
......@@ -32,6 +42,24 @@ export default class ProfileService {
lastConnectionDate: DateTime.fromISO(profileEntity.lastConnectionDate, {
zone: 'utc',
}),
isProfileTypeCompleted: false,
profileType: {
housingType: HousingType.INDIVIDUAL_HOUSE,
constructionYear: ConstructionYear.BETWEEN_1975_AND_1989,
area: 100,
occupantsNumber: 4,
outsideFacingWalls: 2,
floor: Floor.NOT_APPLICABLE,
heating: Heating.INDIVIDUAL,
individualInsulationWork: [
IndividualInsulationWork.WINDOW_REPLACEMENT_AND_WALL_INSULATION,
],
facilitiesInstallation: FacilitiesInstallation.NONE,
hotWaterEquipment: HotWaterEquipment.SOLAR,
warmingFluid: FluidType.ELECTRICITY,
hotWaterFluid: FluidType.ELECTRICITY,
cookingFluid: FluidType.ELECTRICITY,
},
}
return profile
}
......
......@@ -3,6 +3,16 @@ import { UPDATE_PROFILE, SET_FIRST_CONNECTION } from './profile.actions'
import { Profile } from 'models'
import { DateTime } from 'luxon'
import { profileData } from '../../../test/__mocks__/profile.mock'
import {
ConstructionYear,
FacilitiesInstallation,
Floor,
Heating,
HotWaterEquipment,
HousingType,
IndividualInsulationWork,
} from 'enum/profileType.enum'
import { FluidType } from 'enum/fluid.enum'
const mockInitialState: Profile = {
id: '',
......@@ -10,6 +20,7 @@ const mockInitialState: Profile = {
challengeHash: '',
duelHash: '',
quizHash: '',
explorationHash: '',
isFirstConnection: false,
lastConnectionDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
haveSeenFavoriteModal: true,
......@@ -17,6 +28,24 @@ const mockInitialState: Profile = {
haveSeenLastReport: true,
sendReportNotification: false,
monthlyReportDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
isProfileTypeCompleted: false,
profileType: {
housingType: HousingType.INDIVIDUAL_HOUSE,
constructionYear: ConstructionYear.BETWEEN_1975_AND_1989,
area: 100,
occupantsNumber: 4,
outsideFacingWalls: 2,
floor: Floor.NOT_APPLICABLE,
heating: Heating.INDIVIDUAL,
individualInsulationWork: [
IndividualInsulationWork.WINDOW_REPLACEMENT_AND_WALL_INSULATION,
],
facilitiesInstallation: FacilitiesInstallation.NONE,
hotWaterEquipment: HotWaterEquipment.SOLAR,
warmingFluid: FluidType.ELECTRICITY,
hotWaterFluid: FluidType.ELECTRICITY,
cookingFluid: FluidType.ELECTRICITY,
},
}
describe('profile reducer', () => {
......
......@@ -31,7 +31,7 @@ const initialState: Profile = {
haveSeenLastReport: true,
sendReportNotification: false,
monthlyReportDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),
isProfileCompleted: false,
isProfileTypeCompleted: false,
profileType: {
housingType: HousingType.INDIVIDUAL_HOUSE,
constructionYear: ConstructionYear.BETWEEN_1975_AND_1989,
......
......@@ -48,5 +48,5 @@ export const profileData: Profile = {
hotWaterFluid: FluidType.ELECTRICITY,
cookingFluid: FluidType.ELECTRICITY,
},
isProfileCompleted: true,
isProfileTypeCompleted: false,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment