@open3cl/engine 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/11_nadeq.spec.js +3 -2
- package/16.2_production_enr.spec.js +1 -0
- package/3.2.1_mur.spec.js +1 -0
- package/3.2.2_plancher_bas.spec.js +1 -0
- package/3.3_baie_vitree.spec.js +1 -0
- package/6.1_apport_gratuit.spec.js +1 -0
- package/7_inertie.spec.js +4 -3
- package/9_chauffage.spec.js +1 -0
- package/9_conso_ch.spec.js +1 -0
- package/9_generateur_ch.spec.js +1 -0
- package/conso.spec.js +1 -0
- package/core/assets/domain/synchronize-assets.spec.js +9 -9
- package/core/assets/domain/synchronize-c1-tables.spec.js +4 -4
- package/core/assets/domain/synchronize-dpe-ges-limit-values-tables.spec.js +6 -6
- package/core/assets/domain/synchronize-enum-tables.spec.js +10 -10
- package/core/assets/domain/synchronize-solicitations-tables.spec.js +6 -6
- package/core/assets/domain/synchronize-valeur-tables.spec.js +14 -14
- package/core/file/infrastructure/adapter/file.store.spec.js +5 -4
- package/core/tv/infrastructure/tvs.store.spec.js +3 -2
- package/core/util/infrastructure/object-util.spec.js +2 -1
- package/core/util/logger/log-service.js +47 -0
- package/features/dpe/domain/models/baie-ets.model.ts +12 -0
- package/features/dpe/domain/models/baie-vitree.model.ts +97 -0
- package/features/dpe/domain/models/climatisation.model.ts +25 -0
- package/features/dpe/domain/models/dpe.model.ts +194 -0
- package/features/dpe/domain/models/ets.model.ts +19 -0
- package/features/dpe/domain/models/installation-chauffage.model.ts +101 -0
- package/features/dpe/domain/models/installation-ecs.model.ts +76 -0
- package/features/dpe/domain/models/mur.model.ts +37 -0
- package/features/dpe/domain/models/plancher-bas.model.ts +38 -0
- package/features/dpe/domain/models/plancher-haut.model.ts +33 -0
- package/features/dpe/domain/models/pont-thermique.model.ts +21 -0
- package/features/dpe/domain/models/porte.model.ts +31 -0
- package/features/dpe/domain/models/production-elec-enr.model.ts +27 -0
- package/features/dpe/domain/models/sortie.model.ts +178 -0
- package/features/dpe/domain/models/type-habitation.model.js +8 -0
- package/features/dpe/domain/models/type-ventilation.model.js +8 -0
- package/features/dpe/domain/models/ventilation.model.ts +33 -0
- package/features/dpe/infrastructure/baieVitreeTv.store.js +292 -0
- package/features/dpe/infrastructure/baieVitreeTv.store.spec.js +352 -0
- package/features/dpe/infrastructure/tv.store.js +356 -0
- package/features/dpe/infrastructure/tv.store.spec.js +607 -0
- package/features/engine/domain/constants.js +1 -0
- package/features/engine/domain/contexte.builder.js +140 -0
- package/features/engine/domain/contexte.builder.spec.js +152 -0
- package/features/engine/domain/engine.service.js +139 -0
- package/features/engine/domain/engine.service.spec.js +7 -0
- package/features/engine/domain/enveloppe/baie_vitree/deperdition-baie-vitree.service.js +292 -0
- package/features/engine/domain/enveloppe/baie_vitree/deperdition-baie-vitree.service.spec.js +484 -0
- package/features/engine/domain/enveloppe/deperdition-enveloppe.service.js +278 -0
- package/features/engine/domain/enveloppe/deperdition-enveloppe.service.spec.js +282 -0
- package/features/engine/domain/enveloppe/deperdition.service.js +101 -0
- package/features/engine/domain/enveloppe/mur/deperdition-mur.service.js +168 -0
- package/features/engine/domain/enveloppe/mur/deperdition-mur.service.spec.js +345 -0
- package/features/engine/domain/enveloppe/plancher_bas/deperdition-plancher-bas.service.js +169 -0
- package/features/engine/domain/enveloppe/plancher_bas/deperdition-plancher-bas.service.spec.js +200 -0
- package/features/engine/domain/enveloppe/plancher_haut/deperdition-plancher-haut.service.js +136 -0
- package/features/engine/domain/enveloppe/plancher_haut/deperdition-plancher-haut.service.spec.js +211 -0
- package/features/engine/domain/enveloppe/porte/deperdition-porte.service.js +56 -0
- package/features/engine/domain/enveloppe/porte/deperdition-porte.service.spec.js +116 -0
- package/features/engine/domain/enveloppe/ventilation/deperdition-ventilation.service.js +338 -0
- package/features/engine/domain/enveloppe/ventilation/deperdition-ventilation.service.spec.js +442 -0
- package/features/engine/domain/models/contexte.model.ts +10 -0
- package/features/engine/domain/models/deperdition.model.ts +8 -0
- package/features/normalizer/domain/dpe-normalizer.service.js +24 -0
- package/features/normalizer/domain/dpe-normalizer.service.spec.js +3 -0
- package/ficheTechnique.spec.js +4 -3
- package/output.js +1 -0
- package/package.json +9 -8
- package/tv-v2.js +79121 -0
- package/utils.js +2 -2
- package/utils.spec.js +4 -3
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import corpus from '../../../../../../test/corpus-sano.json';
|
|
2
|
+
import { getAdemeFileJson } from '../../../../../../test/test-helpers.js';
|
|
3
|
+
import { ContexteBuilder } from '../../contexte.builder.js';
|
|
4
|
+
import { DpeNormalizerService } from '../../../../normalizer/domain/dpe-normalizer.service.js';
|
|
5
|
+
import { DeperditionBaieVitreeService } from './deperdition-baie-vitree.service.js';
|
|
6
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
7
|
+
import { BaieVitreeTvStore } from '../../../../dpe/infrastructure/baieVitreeTv.store.js';
|
|
8
|
+
|
|
9
|
+
/** @type {DeperditionBaieVitreeService} **/
|
|
10
|
+
let service;
|
|
11
|
+
|
|
12
|
+
/** @type {DpeNormalizerService} **/
|
|
13
|
+
let normalizerService;
|
|
14
|
+
|
|
15
|
+
/** @type {BaieVitreeTvStore} **/
|
|
16
|
+
let tvStore;
|
|
17
|
+
|
|
18
|
+
/** @type {ContexteBuilder} **/
|
|
19
|
+
let contexteBuilder;
|
|
20
|
+
|
|
21
|
+
describe('Calcul de déperdition des baies vitrées', () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
tvStore = new BaieVitreeTvStore();
|
|
24
|
+
service = new DeperditionBaieVitreeService(tvStore);
|
|
25
|
+
normalizerService = new DpeNormalizerService();
|
|
26
|
+
contexteBuilder = new ContexteBuilder();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe('Determination du coefficient sw', () => {
|
|
30
|
+
test('Doit retourner sw_saisi directement', () => {
|
|
31
|
+
vi.spyOn(tvStore, 'getSw').mockReturnValue(18.8);
|
|
32
|
+
/**
|
|
33
|
+
* @type {BaieVitree}
|
|
34
|
+
*/
|
|
35
|
+
let bv = {
|
|
36
|
+
donnee_entree: {
|
|
37
|
+
enum_type_materiaux_menuiserie_id: '1',
|
|
38
|
+
enum_type_vitrage_id: '2',
|
|
39
|
+
enum_type_baie_id: '6',
|
|
40
|
+
vitrage_vir: '1',
|
|
41
|
+
enum_type_pose_id: '3',
|
|
42
|
+
sw_saisi: 4.5
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
let sw = service.sw(bv);
|
|
47
|
+
expect(tvStore.getSw).not.toHaveBeenCalled();
|
|
48
|
+
expect(sw).toBe(4.5);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('Ne doit pas utiliser vitrage_vir et enum_type_pose_id si enum_type_materiaux_menuiserie_id = 1 ou 2', () => {
|
|
52
|
+
vi.spyOn(tvStore, 'getSw').mockReturnValue(18.8);
|
|
53
|
+
/**
|
|
54
|
+
* @type {BaieVitree}
|
|
55
|
+
*/
|
|
56
|
+
let bv = {
|
|
57
|
+
donnee_entree: {
|
|
58
|
+
enum_type_materiaux_menuiserie_id: '1',
|
|
59
|
+
enum_type_vitrage_id: '2',
|
|
60
|
+
enum_type_baie_id: '6',
|
|
61
|
+
vitrage_vir: '1',
|
|
62
|
+
enum_type_pose_id: '3'
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
let sw = service.sw(bv);
|
|
67
|
+
expect(tvStore.getSw).toHaveBeenCalledWith('2', '6', '1', undefined, undefined);
|
|
68
|
+
expect(sw).toBe(18.8);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('Doit utiliser vitrage_vir et enum_type_pose_id si enum_type_materiaux_menuiserie_id != 1 et != 2', () => {
|
|
72
|
+
vi.spyOn(tvStore, 'getSw').mockReturnValue(18.8);
|
|
73
|
+
/**
|
|
74
|
+
* @type {BaieVitree}
|
|
75
|
+
*/
|
|
76
|
+
let bv = {
|
|
77
|
+
donnee_entree: {
|
|
78
|
+
enum_type_materiaux_menuiserie_id: '4',
|
|
79
|
+
enum_type_vitrage_id: '2',
|
|
80
|
+
enum_type_baie_id: '6',
|
|
81
|
+
vitrage_vir: '1',
|
|
82
|
+
enum_type_pose_id: '3'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
let sw = service.sw(bv);
|
|
87
|
+
expect(tvStore.getSw).toHaveBeenCalledWith('2', '6', '4', '1', '3');
|
|
88
|
+
expect(sw).toBe(18.8);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('Doit prendre en compte le survitrage si présent', () => {
|
|
92
|
+
vi.spyOn(tvStore, 'getSw').mockReturnValue(18.8);
|
|
93
|
+
/**
|
|
94
|
+
* @type {BaieVitree}
|
|
95
|
+
*/
|
|
96
|
+
let bv = {
|
|
97
|
+
donnee_entree: {
|
|
98
|
+
enum_type_materiaux_menuiserie_id: '4',
|
|
99
|
+
enum_type_vitrage_id: '2',
|
|
100
|
+
enum_type_baie_id: '6',
|
|
101
|
+
vitrage_vir: '1',
|
|
102
|
+
enum_type_pose_id: '3',
|
|
103
|
+
double_fenetre: 1
|
|
104
|
+
},
|
|
105
|
+
baie_vitree_double_fenetre: {
|
|
106
|
+
donnee_entree: {
|
|
107
|
+
enum_type_materiaux_menuiserie_id: '4',
|
|
108
|
+
enum_type_vitrage_id: '2',
|
|
109
|
+
enum_type_baie_id: '6',
|
|
110
|
+
vitrage_vir: '1',
|
|
111
|
+
enum_type_pose_id: '3'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
let sw = service.sw(bv);
|
|
117
|
+
expect(tvStore.getSw).toHaveBeenNthCalledWith(2, '2', '6', '4', '1', '3');
|
|
118
|
+
expect(sw).toBe(18.8 * 18.8);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('Determination du coefficient uw', () => {
|
|
123
|
+
test('Doit retourner uw_saisi directement', () => {
|
|
124
|
+
vi.spyOn(tvStore, 'getUw').mockReturnValue(18.8);
|
|
125
|
+
|
|
126
|
+
let uw = service.uw({ donnee_entree: { uw_saisi: 16.4 } }, 2.4);
|
|
127
|
+
|
|
128
|
+
expect(tvStore.getUw).not.toHaveBeenCalled();
|
|
129
|
+
expect(uw).toBe(16.4);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('Doit appeler tvStore', () => {
|
|
133
|
+
vi.spyOn(tvStore, 'getUw').mockReturnValue(18.8);
|
|
134
|
+
|
|
135
|
+
let uw = service.uw(
|
|
136
|
+
{ donnee_entree: { enum_type_baie_id: '10', enum_type_materiaux_menuiserie_id: '1' } },
|
|
137
|
+
2.4
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
expect(tvStore.getUw).toHaveBeenCalledWith('10', '1', 2.4);
|
|
141
|
+
expect(uw).toBe(18.8);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('Doit prendre en compte le survitrage si présent', () => {
|
|
145
|
+
vi.spyOn(tvStore, 'getUw').mockReturnValue(18.8);
|
|
146
|
+
/**
|
|
147
|
+
* @type {BaieVitree}
|
|
148
|
+
*/
|
|
149
|
+
let bv = {
|
|
150
|
+
donnee_entree: {
|
|
151
|
+
ug_saisi: 2.5,
|
|
152
|
+
enum_type_materiaux_menuiserie_id: '4',
|
|
153
|
+
enum_type_baie_id: '6',
|
|
154
|
+
double_fenetre: 1
|
|
155
|
+
},
|
|
156
|
+
baie_vitree_double_fenetre: {
|
|
157
|
+
donnee_entree: {
|
|
158
|
+
ug_saisi: 2.5,
|
|
159
|
+
enum_type_materiaux_menuiserie_id: '4',
|
|
160
|
+
enum_type_baie_id: '6'
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
let uw = service.uw(bv, 2.4);
|
|
166
|
+
expect(tvStore.getUw).toHaveBeenNthCalledWith(2, '6', '4', 2.5);
|
|
167
|
+
expect(uw).toBe(1 / (1 / 18.8 + 1 / 18.8 + 0.07));
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
describe('Determination du coefficient ug', () => {
|
|
172
|
+
test('Doit retourner ug_saisi directement', () => {
|
|
173
|
+
vi.spyOn(tvStore, 'getUg').mockReturnValue(18.8);
|
|
174
|
+
|
|
175
|
+
let ug = service.ug({ ug_saisi: 16.4 });
|
|
176
|
+
|
|
177
|
+
expect(tvStore.getUg).not.toHaveBeenCalled();
|
|
178
|
+
expect(ug).toBe(16.4);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test('Ne retourne aucune valeur pour les parois en brique ou polycarbonate', () => {
|
|
182
|
+
vi.spyOn(tvStore, 'getUg').mockReturnValue(18.8);
|
|
183
|
+
|
|
184
|
+
let ug = service.ug({ enum_type_baie_id: '1' });
|
|
185
|
+
|
|
186
|
+
expect(tvStore.getUg).not.toHaveBeenCalled();
|
|
187
|
+
expect(ug).toBeUndefined();
|
|
188
|
+
|
|
189
|
+
ug = service.ug({ enum_type_baie_id: '2' });
|
|
190
|
+
|
|
191
|
+
expect(tvStore.getUg).not.toHaveBeenCalled();
|
|
192
|
+
expect(ug).toBeUndefined();
|
|
193
|
+
|
|
194
|
+
ug = service.ug({ enum_type_baie_id: '3' });
|
|
195
|
+
|
|
196
|
+
expect(tvStore.getUg).not.toHaveBeenCalled();
|
|
197
|
+
expect(ug).toBeUndefined();
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test('Doit appeler tvStore sans epaisseur, enum_type_gaz_lame_id, enum_inclinaison_vitrage_id, vitrage_vir pour les simples vitrages', () => {
|
|
201
|
+
vi.spyOn(tvStore, 'getUg').mockReturnValue(18.8);
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @type {BaieVitreeDE}
|
|
205
|
+
*/
|
|
206
|
+
let bvDE = {
|
|
207
|
+
enum_type_vitrage_id: '1',
|
|
208
|
+
vitrage_vir: '1',
|
|
209
|
+
enum_inclinaison_vitrage_id: '1',
|
|
210
|
+
enum_type_gaz_lame_id: '1',
|
|
211
|
+
epaisseur_lame: '18'
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
let uw = service.ug(bvDE);
|
|
215
|
+
|
|
216
|
+
expect(tvStore.getUg).toHaveBeenCalledWith('1', undefined, undefined, undefined, undefined);
|
|
217
|
+
expect(uw).toBe(18.8);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
test('Doit appeler tvStore avec epaisseur, enum_type_gaz_lame_id, enum_inclinaison_vitrage_id, vitrage_vir pour les doubles vitrages', () => {
|
|
221
|
+
vi.spyOn(tvStore, 'getUg').mockReturnValue(18.8);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @type {BaieVitreeDE}
|
|
225
|
+
*/
|
|
226
|
+
let bvDE = {
|
|
227
|
+
enum_type_vitrage_id: '2',
|
|
228
|
+
vitrage_vir: '1',
|
|
229
|
+
enum_inclinaison_vitrage_id: '2',
|
|
230
|
+
enum_type_gaz_lame_id: '1',
|
|
231
|
+
epaisseur_lame: '18'
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
let uw = service.ug(bvDE);
|
|
235
|
+
|
|
236
|
+
expect(tvStore.getUg).toHaveBeenCalledWith('2', '1', '2', '1', 18);
|
|
237
|
+
expect(uw).toBe(18.8);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test("Doit appeler tvStore avec l'epaisseur la plus proche dans celles qui sont disponibles", () => {
|
|
241
|
+
vi.spyOn(tvStore, 'getUg').mockReturnValue(18.8);
|
|
242
|
+
vi.spyOn(tvStore, 'getEpaisseurAvailableForUg').mockReturnValue([2, 4, 8]);
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @type {BaieVitreeDE}
|
|
246
|
+
*/
|
|
247
|
+
let bvDE = {
|
|
248
|
+
enum_type_vitrage_id: '2',
|
|
249
|
+
vitrage_vir: '1',
|
|
250
|
+
enum_inclinaison_vitrage_id: '2',
|
|
251
|
+
enum_type_gaz_lame_id: '1',
|
|
252
|
+
epaisseur_lame: '18'
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
let uw = service.ug(bvDE);
|
|
256
|
+
|
|
257
|
+
expect(tvStore.getUg).toHaveBeenCalledWith('2', '1', '2', '1', 8);
|
|
258
|
+
expect(uw).toBe(18.8);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
test('Doit appeler tvStore avec un équivalent double vitrage pour un sur vitrage avec majoration de 0.1', () => {
|
|
262
|
+
vi.spyOn(tvStore, 'getUg').mockReturnValue(18.8);
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @type {BaieVitreeDE}
|
|
266
|
+
*/
|
|
267
|
+
let bvDE = {
|
|
268
|
+
enum_type_vitrage_id: '4',
|
|
269
|
+
vitrage_vir: '0',
|
|
270
|
+
enum_inclinaison_vitrage_id: '3',
|
|
271
|
+
enum_type_gaz_lame_id: '1',
|
|
272
|
+
epaisseur_lame: '20'
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
let uw = service.ug(bvDE);
|
|
276
|
+
|
|
277
|
+
expect(tvStore.getUg).toHaveBeenCalledWith('2', '1', '3', '0', 20);
|
|
278
|
+
expect(uw).toBe(18.8 + 0.1);
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
describe('Determination du facteur d’ensoleillement', () => {
|
|
283
|
+
test('Doit retourner fe1 = 1 et fe2 = 1 si aucun masque', () => {
|
|
284
|
+
vi.spyOn(tvStore, 'getMasqueProche').mockReturnValue(1.2);
|
|
285
|
+
vi.spyOn(tvStore, 'getMasqueLointainHomogene').mockReturnValue(3.4);
|
|
286
|
+
vi.spyOn(tvStore, 'getOmbre').mockReturnValue(0.5);
|
|
287
|
+
|
|
288
|
+
let [fe1, fe2] = service.fe({});
|
|
289
|
+
|
|
290
|
+
expect(tvStore.getMasqueProche).not.toHaveBeenCalled();
|
|
291
|
+
expect(tvStore.getMasqueLointainHomogene).not.toHaveBeenCalled();
|
|
292
|
+
expect(tvStore.getOmbre).not.toHaveBeenCalled();
|
|
293
|
+
expect(fe1).toBe(1);
|
|
294
|
+
expect(fe2).toBe(1);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
test('Doit utiliser tvStore pour les masques proches', () => {
|
|
298
|
+
vi.spyOn(tvStore, 'getMasqueProche').mockReturnValue(1.2);
|
|
299
|
+
vi.spyOn(tvStore, 'getMasqueLointainHomogene').mockReturnValue(3.4);
|
|
300
|
+
vi.spyOn(tvStore, 'getOmbre').mockReturnValue(0.5);
|
|
301
|
+
|
|
302
|
+
let [fe1, fe2] = service.fe({ tv_coef_masque_proche_id: '1' });
|
|
303
|
+
|
|
304
|
+
expect(tvStore.getMasqueProche).toHaveBeenCalledWith('1');
|
|
305
|
+
expect(tvStore.getMasqueLointainHomogene).not.toHaveBeenCalled();
|
|
306
|
+
expect(tvStore.getOmbre).not.toHaveBeenCalled();
|
|
307
|
+
expect(fe1).toBe(1.2);
|
|
308
|
+
expect(fe2).toBe(1);
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
test('Doit utiliser tvStore pour les masques lointains homogènes', () => {
|
|
312
|
+
vi.spyOn(tvStore, 'getMasqueProche').mockReturnValue(1.2);
|
|
313
|
+
vi.spyOn(tvStore, 'getMasqueLointainHomogene').mockReturnValue(3.4);
|
|
314
|
+
vi.spyOn(tvStore, 'getOmbre').mockReturnValue(0.5);
|
|
315
|
+
|
|
316
|
+
let [fe1, fe2] = service.fe({ tv_coef_masque_lointain_homogene_id: '2' });
|
|
317
|
+
|
|
318
|
+
expect(tvStore.getMasqueLointainHomogene).toHaveBeenCalledWith('2');
|
|
319
|
+
expect(tvStore.getMasqueProche).not.toHaveBeenCalled();
|
|
320
|
+
expect(tvStore.getOmbre).not.toHaveBeenCalled();
|
|
321
|
+
expect(fe1).toBe(1);
|
|
322
|
+
expect(fe2).toBe(3.4);
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
test.each([
|
|
326
|
+
{
|
|
327
|
+
label: 'collection masque_lointain_non_homogene_collection undefined',
|
|
328
|
+
masqueLointainNonHomogene: undefined,
|
|
329
|
+
tvStoreMasqueLointainNonHomogene: undefined,
|
|
330
|
+
fe1Expected: 1,
|
|
331
|
+
fe2Expected: 1
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
label: 'collection masque_lointain_non_homogene_collection vide',
|
|
335
|
+
masqueLointainNonHomogene: { masque_lointain_non_homogene: undefined },
|
|
336
|
+
tvStoreMasqueLointainNonHomogene: undefined,
|
|
337
|
+
fe1Expected: 1,
|
|
338
|
+
fe2Expected: 1
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
label: 'collection masque_lointain_non_homogene_collection vide',
|
|
342
|
+
masqueLointainNonHomogene: { masque_lointain_non_homogene: [] },
|
|
343
|
+
tvStoreMasqueLointainNonHomogene: undefined,
|
|
344
|
+
fe1Expected: 1,
|
|
345
|
+
fe2Expected: 1
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
label: 'collection masque_lointain_non_homogene_collection non array',
|
|
349
|
+
masqueLointainNonHomogene: {
|
|
350
|
+
masque_lointain_non_homogene: { tv_coef_masque_lointain_non_homogene_id: '1' }
|
|
351
|
+
},
|
|
352
|
+
tvStoreMasqueLointainNonHomogene: '1',
|
|
353
|
+
fe1Expected: 1,
|
|
354
|
+
fe2Expected: 0.8
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
label: 'collection masque_lointain_non_homogene_collection array',
|
|
358
|
+
masqueLointainNonHomogene: {
|
|
359
|
+
masque_lointain_non_homogene: [
|
|
360
|
+
{ tv_coef_masque_lointain_non_homogene_id: '1' },
|
|
361
|
+
{ tv_coef_masque_lointain_non_homogene_id: '2' }
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
tvStoreMasqueLointainNonHomogene: '1',
|
|
365
|
+
fe1Expected: 1,
|
|
366
|
+
fe2Expected: 0.6
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
label: 'collection masque_lointain_non_homogene_collection array and fe2 min 0',
|
|
370
|
+
masqueLointainNonHomogene: {
|
|
371
|
+
masque_lointain_non_homogene: [
|
|
372
|
+
{ tv_coef_masque_lointain_non_homogene_id: '1' },
|
|
373
|
+
{ tv_coef_masque_lointain_non_homogene_id: '2' }
|
|
374
|
+
]
|
|
375
|
+
},
|
|
376
|
+
tvStoreMasqueLointainNonHomogene: '1',
|
|
377
|
+
tvStoreGetOmbreValue: 60,
|
|
378
|
+
fe1Expected: 1,
|
|
379
|
+
fe2Expected: 0
|
|
380
|
+
}
|
|
381
|
+
])(
|
|
382
|
+
'Doit utiliser tvStore pour les masques lointains non homogènes pour $label',
|
|
383
|
+
({
|
|
384
|
+
masqueLointainNonHomogene,
|
|
385
|
+
tvStoreMasqueLointainNonHomogene,
|
|
386
|
+
tvStoreGetOmbreValue = undefined,
|
|
387
|
+
fe1Expected,
|
|
388
|
+
fe2Expected
|
|
389
|
+
}) => {
|
|
390
|
+
vi.spyOn(tvStore, 'getMasqueProche').mockReturnValue(1.2);
|
|
391
|
+
vi.spyOn(tvStore, 'getMasqueLointainHomogene').mockReturnValue(3.4);
|
|
392
|
+
vi.spyOn(tvStore, 'getOmbre').mockReturnValue(tvStoreGetOmbreValue || 20);
|
|
393
|
+
|
|
394
|
+
let bvDE = {
|
|
395
|
+
masque_lointain_non_homogene_collection: masqueLointainNonHomogene
|
|
396
|
+
};
|
|
397
|
+
let [fe1, fe2] = service.fe(bvDE);
|
|
398
|
+
|
|
399
|
+
if (tvStoreMasqueLointainNonHomogene === undefined) {
|
|
400
|
+
expect(tvStore.getOmbre).not.toHaveBeenCalled();
|
|
401
|
+
} else {
|
|
402
|
+
expect(tvStore.getOmbre).toHaveBeenCalledWith(tvStoreMasqueLointainNonHomogene);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
expect(tvStore.getMasqueLointainHomogene).not.toHaveBeenCalled();
|
|
406
|
+
expect(tvStore.getMasqueProche).not.toHaveBeenCalled();
|
|
407
|
+
|
|
408
|
+
expect(fe1).toBeCloseTo(fe1Expected, 2);
|
|
409
|
+
expect(fe2).toBeCloseTo(fe2Expected, 2);
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
test('Récupération du coefficient ujn', () => {
|
|
415
|
+
vi.spyOn(tvStore, 'getUjn').mockReturnValue(18.8);
|
|
416
|
+
|
|
417
|
+
let ujn = service.ujn({ ujn_saisi: 16.4 }, 2.4);
|
|
418
|
+
|
|
419
|
+
expect(tvStore.getUjn).not.toHaveBeenCalled();
|
|
420
|
+
expect(ujn).toBe(16.4);
|
|
421
|
+
|
|
422
|
+
ujn = service.ujn({ enum_type_fermeture_id: 1 }, 2.4);
|
|
423
|
+
|
|
424
|
+
expect(tvStore.getUjn).toHaveBeenCalledWith(1, 2.4);
|
|
425
|
+
expect(ujn).toBe(18.8);
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
test("Récupération de l'ombre apportée par un masque lointain", () => {
|
|
429
|
+
vi.spyOn(tvStore, 'getOmbre').mockReturnValue(12.4);
|
|
430
|
+
|
|
431
|
+
const ombre = service.calcOmbre({ tv_coef_masque_lointain_non_homogene_id: 16.4 });
|
|
432
|
+
|
|
433
|
+
expect(tvStore.getOmbre).toHaveBeenCalledWith(16.4);
|
|
434
|
+
expect(ombre).toBe(12.4);
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
test('u_menuiserie est définit par ujn seulement pour les baie vitrée avec fermeture', () => {
|
|
438
|
+
let bvDI = service.execute(
|
|
439
|
+
{},
|
|
440
|
+
{ donnee_entree: { ujn_saisi: 5.6, enum_type_fermeture_id: 1 } }
|
|
441
|
+
);
|
|
442
|
+
expect(bvDI.u_menuiserie).toBeUndefined();
|
|
443
|
+
|
|
444
|
+
bvDI = service.execute({}, { donnee_entree: { ujn_saisi: 5.6, enum_type_fermeture_id: 2 } });
|
|
445
|
+
expect(bvDI.u_menuiserie).toBe(5.6);
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
describe("Test d'intégration des baies vitrées", () => {
|
|
449
|
+
test.each(corpus)('vérification des DI des baies vitrées pour dpe %s', (ademeId) => {
|
|
450
|
+
let dpeRequest = getAdemeFileJson(ademeId);
|
|
451
|
+
dpeRequest = normalizerService.normalize(dpeRequest);
|
|
452
|
+
|
|
453
|
+
/** @type {Contexte} */
|
|
454
|
+
const ctx = contexteBuilder.fromDpe(dpeRequest);
|
|
455
|
+
|
|
456
|
+
const bvs = dpeRequest.logement.enveloppe.baie_vitree_collection?.baie_vitree || [];
|
|
457
|
+
|
|
458
|
+
bvs.forEach((bv) => {
|
|
459
|
+
const di = service.execute(ctx, bv);
|
|
460
|
+
|
|
461
|
+
expect(di.b).toBeCloseTo(bv.donnee_intermediaire.b, 2);
|
|
462
|
+
|
|
463
|
+
if (bv.donnee_intermediaire.ug) {
|
|
464
|
+
expect(di.ug).toBeCloseTo(bv.donnee_intermediaire.ug, 2);
|
|
465
|
+
} else {
|
|
466
|
+
expect(di.ug).toBeUndefined();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
expect(di.uw).toBeCloseTo(bv.donnee_intermediaire.uw, 2);
|
|
470
|
+
|
|
471
|
+
if (bv.donnee_intermediaire.ujn) {
|
|
472
|
+
expect(di.ujn).toBeCloseTo(bv.donnee_intermediaire.ujn, 2);
|
|
473
|
+
} else {
|
|
474
|
+
expect(di.ujn).toBeUndefined();
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
expect(di.u_menuiserie).toBeCloseTo(bv.donnee_intermediaire.u_menuiserie, 2);
|
|
478
|
+
expect(di.sw).toBeCloseTo(bv.donnee_intermediaire.sw, 2);
|
|
479
|
+
expect(di.fe1).toBeCloseTo(bv.donnee_intermediaire.fe1, 2);
|
|
480
|
+
expect(di.fe2).toBeCloseTo(bv.donnee_intermediaire.fe2, 2);
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
});
|