@open3cl/engine 1.0.6 → 1.0.7
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 +95 -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/tv.store.js +389 -0
- package/features/dpe/infrastructure/tv.store.spec.js +690 -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/deperdition-enveloppe.service.js +262 -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 +393 -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
package/11_nadeq.spec.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Nadeq } from './11_nadeq.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
2
3
|
|
|
3
4
|
describe('Nadeq unit tests', () => {
|
|
4
5
|
/**
|
|
@@ -6,7 +7,7 @@ describe('Nadeq unit tests', () => {
|
|
|
6
7
|
*/
|
|
7
8
|
const nadeq = new Nadeq();
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
test.each([
|
|
10
11
|
[1, 8],
|
|
11
12
|
[1, 28],
|
|
12
13
|
[1.28125, 45],
|
|
@@ -26,7 +27,7 @@ describe('Nadeq unit tests', () => {
|
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
test.each([
|
|
30
31
|
[1, 8, 1],
|
|
31
32
|
[2, 8, 2],
|
|
32
33
|
[1.3375, 28, 1],
|
package/3.2.1_mur.spec.js
CHANGED
package/3.3_baie_vitree.spec.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import calc_bv from './3.3_baie_vitree.js';
|
|
2
2
|
import { PRECISION } from '../test/constant.js';
|
|
3
|
+
import { describe, expect, test } from 'vitest';
|
|
3
4
|
|
|
4
5
|
describe('Recherche de bugs dans le calcul de déperdition des baies vitrées', () => {
|
|
5
6
|
test('calcul de déperdition pour les murs de 2187E0982013C baie 1', () => {
|
package/7_inertie.spec.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Inertie } from './7_inertie.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
2
3
|
|
|
3
4
|
describe('Inertie unit tests', () => {
|
|
4
5
|
/**
|
|
@@ -6,7 +7,7 @@ describe('Inertie unit tests', () => {
|
|
|
6
7
|
*/
|
|
7
8
|
const inertie = new Inertie();
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
test.each([
|
|
10
11
|
[1, 1, 0, 9],
|
|
11
12
|
[1, 1, 0, 11],
|
|
12
13
|
[1, 1, 0, 12],
|
|
@@ -34,7 +35,7 @@ describe('Inertie unit tests', () => {
|
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
test.each([
|
|
38
39
|
[1, 2, 8],
|
|
39
40
|
[1, 4, 8],
|
|
40
41
|
[1, 9, 8],
|
|
@@ -53,7 +54,7 @@ describe('Inertie unit tests', () => {
|
|
|
53
54
|
}
|
|
54
55
|
);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
test.each([
|
|
57
58
|
[1, 1, 0, 2, 0],
|
|
58
59
|
[1, 1, 0, 3, 0],
|
|
59
60
|
[1, 1, 0, 4, 0],
|
package/9_chauffage.spec.js
CHANGED
package/9_conso_ch.spec.js
CHANGED
package/9_generateur_ch.spec.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { calc_generateur_ch } from './9_generateur_ch.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
2
3
|
|
|
3
4
|
describe('Recherche de bugs dans le calcul de la consommation des generateurs de chauffage', () => {
|
|
4
5
|
test('calcul de la consommation des generateurs de chauffage pour 2475E2510509B', () => {
|
package/conso.spec.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { SynchronizeAssets } from './synchronize-assets.js';
|
|
2
2
|
import { SynchronizeEnumTables } from './synchronize-enum-tables.js';
|
|
3
3
|
import { SynchronizeValeurTables } from './synchronize-valeur-tables.js';
|
|
4
|
-
import {
|
|
4
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
5
5
|
|
|
6
6
|
describe('SynchronizeAssets unit tests', () => {
|
|
7
|
-
|
|
7
|
+
test('should synchronize xlsx and ods files', () => {
|
|
8
8
|
const synchronizeEnumTables = new SynchronizeEnumTables(null, null);
|
|
9
9
|
const synchronizeValeurTables = new SynchronizeValeurTables(null, null, null);
|
|
10
10
|
const synchronizeAssets = new SynchronizeAssets(synchronizeEnumTables, synchronizeValeurTables);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
vi.spyOn(console, 'log').mockReturnValue(null);
|
|
13
|
+
vi.spyOn(synchronizeEnumTables, 'execute').mockResolvedValue({});
|
|
14
|
+
vi.spyOn(synchronizeValeurTables, 'execute').mockResolvedValue({});
|
|
15
15
|
|
|
16
16
|
return synchronizeAssets.execute().then(() => {
|
|
17
17
|
expect(synchronizeEnumTables.execute).toHaveBeenCalled();
|
|
@@ -20,14 +20,14 @@ describe('SynchronizeAssets unit tests', () => {
|
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
test('should log errors if synchronization has failed', () => {
|
|
24
24
|
const synchronizeEnumTables = new SynchronizeEnumTables(null, null);
|
|
25
25
|
const synchronizeValeurTables = new SynchronizeValeurTables(null, null, null);
|
|
26
26
|
const synchronizeAssets = new SynchronizeAssets(synchronizeEnumTables, synchronizeValeurTables);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
vi.spyOn(console, 'error').mockReturnValue(null);
|
|
29
|
+
vi.spyOn(synchronizeEnumTables, 'execute').mockResolvedValue({});
|
|
30
|
+
vi.spyOn(synchronizeValeurTables, 'execute').mockRejectedValue(null);
|
|
31
31
|
|
|
32
32
|
return synchronizeAssets.execute().catch((error) => {
|
|
33
33
|
expect(error).toBeDefined();
|
|
@@ -2,17 +2,17 @@ import { SynchronizeC1Tables } from './synchronize-c1-tables.js';
|
|
|
2
2
|
import { FileStore } from '../../file/infrastructure/adapter/file.store.js';
|
|
3
3
|
import { ApplicationConfig } from '../../conf/infrastructure/application.config.js';
|
|
4
4
|
import { C1TablesFixture } from '../../../../test/fixtures/core/assets/c1-tables.fixture.js';
|
|
5
|
-
import {
|
|
5
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
6
6
|
|
|
7
7
|
describe('SynchronizeC1Tables unit tests', () => {
|
|
8
|
-
|
|
8
|
+
test('should read and parse 18.5_c1.ods file', () => {
|
|
9
9
|
const fileStore = new FileStore();
|
|
10
10
|
const appConfig = new ApplicationConfig();
|
|
11
11
|
const synchronizeC1Tables = new SynchronizeC1Tables(fileStore, appConfig);
|
|
12
12
|
|
|
13
13
|
const c1Data = C1TablesFixture.aC1Example();
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
vi.spyOn(fileStore, 'readLocalOdsFileAndConvertToJson').mockResolvedValue(c1Data);
|
|
15
|
+
vi.spyOn(ApplicationConfig.prototype, 'c1FilePath', 'get').mockReturnValue('src/file.ods');
|
|
16
16
|
|
|
17
17
|
return synchronizeC1Tables.execute().then((output) => {
|
|
18
18
|
expect(fileStore.readLocalOdsFileAndConvertToJson).toHaveBeenCalled();
|
|
@@ -2,10 +2,10 @@ import { FileStore } from '../../file/infrastructure/adapter/file.store.js';
|
|
|
2
2
|
import { ApplicationConfig } from '../../conf/infrastructure/application.config.js';
|
|
3
3
|
import { DpeGesLimitValuesTablesFixture } from '../../../../test/fixtures/core/assets/dpe-ges-limit-values-tables.fixture.js';
|
|
4
4
|
import { SynchronizeDpeGesLimitValuesTables } from './synchronize-dpe-ges-limit-values-tables.js';
|
|
5
|
-
import {
|
|
5
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
6
6
|
|
|
7
7
|
describe('SynchronizeDpeGesLimitValuesTables unit tests', () => {
|
|
8
|
-
|
|
8
|
+
test('should read and parse dpe_ges_limit_values file', () => {
|
|
9
9
|
const fileStore = new FileStore();
|
|
10
10
|
const appConfig = new ApplicationConfig();
|
|
11
11
|
const synchronizeDpeGesLimitValuesTables = new SynchronizeDpeGesLimitValuesTables(
|
|
@@ -14,10 +14,10 @@ describe('SynchronizeDpeGesLimitValuesTables unit tests', () => {
|
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
const dpeGesLimitData = DpeGesLimitValuesTablesFixture.aDpeGesLimitExample();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
17
|
+
vi.spyOn(fileStore, 'readLocalOdsFileAndConvertToJson').mockResolvedValue(dpeGesLimitData);
|
|
18
|
+
vi.spyOn(ApplicationConfig.prototype, 'solicitationsExtFilePath', 'get').mockReturnValue(
|
|
19
|
+
'src/file.ods'
|
|
20
|
+
);
|
|
21
21
|
|
|
22
22
|
return synchronizeDpeGesLimitValuesTables.execute().then((output) => {
|
|
23
23
|
expect(fileStore.readLocalOdsFileAndConvertToJson).toHaveBeenCalled();
|
|
@@ -2,23 +2,23 @@ import { FileStore } from '../../file/infrastructure/adapter/file.store.js';
|
|
|
2
2
|
import { ApplicationConfig } from '../../conf/infrastructure/application.config.js';
|
|
3
3
|
import { EnumTablesFixture } from '../../../../test/fixtures/core/assets/enum-tables.fixture.js';
|
|
4
4
|
import { SynchronizeEnumTables } from './synchronize-enum-tables.js';
|
|
5
|
-
import {
|
|
5
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
6
6
|
|
|
7
7
|
describe('SynchronizeEnumTables', () => {
|
|
8
|
-
|
|
8
|
+
test('should download, parse and convert enum_tables.xlsx file', () => {
|
|
9
9
|
const fileStore = new FileStore();
|
|
10
10
|
const appConfig = new ApplicationConfig();
|
|
11
11
|
const synchronizeEnumTables = new SynchronizeEnumTables(fileStore, appConfig);
|
|
12
12
|
|
|
13
13
|
const enumTablesData = EnumTablesFixture.anEnumTableExample();
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
vi.spyOn(ApplicationConfig.prototype, 'ademeEnumTablesFileUrl', 'get').mockReturnValue(
|
|
15
|
+
'http://localhost/file.xlsx'
|
|
16
|
+
);
|
|
17
|
+
vi.spyOn(ApplicationConfig.prototype, 'assetsOutputFolder', 'get').mockReturnValue(
|
|
18
|
+
'src/assets'
|
|
19
|
+
);
|
|
20
|
+
vi.spyOn(fileStore, 'downloadXlsxFileAndConvertToJson').mockResolvedValue(enumTablesData);
|
|
21
|
+
vi.spyOn(fileStore, 'writeFileToLocalSystem').mockResolvedValue(null);
|
|
22
22
|
|
|
23
23
|
return synchronizeEnumTables.execute().then(() => {
|
|
24
24
|
expect(fileStore.downloadXlsxFileAndConvertToJson).toHaveBeenCalled();
|
|
@@ -2,19 +2,19 @@ import { FileStore } from '../../file/infrastructure/adapter/file.store.js';
|
|
|
2
2
|
import { ApplicationConfig } from '../../conf/infrastructure/application.config.js';
|
|
3
3
|
import { SynchronizeSolicitationsTables } from './synchronize-solicitations-tables.js';
|
|
4
4
|
import { SolicitationsTablesFixture } from '../../../../test/fixtures/core/assets/solicitations-tables.fixture.js';
|
|
5
|
-
import {
|
|
5
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
6
6
|
|
|
7
7
|
describe('SynchronizeSolicitationsTables unit tests', () => {
|
|
8
|
-
|
|
8
|
+
test('should read and parse 18.2_sollicitations_ext.ods file', () => {
|
|
9
9
|
const fileStore = new FileStore();
|
|
10
10
|
const appConfig = new ApplicationConfig();
|
|
11
11
|
const synchronizeSolicitationsTables = new SynchronizeSolicitationsTables(fileStore, appConfig);
|
|
12
12
|
|
|
13
13
|
const solicitationsData = SolicitationsTablesFixture.aSolicitationExample();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
14
|
+
vi.spyOn(fileStore, 'readLocalOdsFileAndConvertToJson').mockResolvedValue(solicitationsData);
|
|
15
|
+
vi.spyOn(ApplicationConfig.prototype, 'solicitationsExtFilePath', 'get').mockReturnValue(
|
|
16
|
+
'src/file.ods'
|
|
17
|
+
);
|
|
18
18
|
|
|
19
19
|
return synchronizeSolicitationsTables.execute().then((output) => {
|
|
20
20
|
expect(fileStore.readLocalOdsFileAndConvertToJson).toHaveBeenCalled();
|
|
@@ -4,12 +4,12 @@ import { ApplicationConfig } from '../../conf/infrastructure/application.config.
|
|
|
4
4
|
import { SynchronizeC1Tables } from './synchronize-c1-tables.js';
|
|
5
5
|
import { SynchronizeSolicitationsTables } from './synchronize-solicitations-tables.js';
|
|
6
6
|
import { ValeurTablesFixture } from '../../../../test/fixtures/core/assets/valeur-tables.fixture.js';
|
|
7
|
-
import { jest } from '@jest/globals';
|
|
8
7
|
import { SynchronizeDpeGesLimitValuesTables } from './synchronize-dpe-ges-limit-values-tables.js';
|
|
9
8
|
import { AddAdditionnalUeValuesTables } from './add-additionnal-ue-values-tables.js';
|
|
9
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
10
10
|
|
|
11
11
|
describe('SynchronizeValeurTables unit tests', () => {
|
|
12
|
-
|
|
12
|
+
test('should download, parse and convert valeur_tables.xlsx file', () => {
|
|
13
13
|
const fileStore = new FileStore();
|
|
14
14
|
const appConfig = new ApplicationConfig();
|
|
15
15
|
const synchronizeC1Tables = new SynchronizeC1Tables(fileStore, appConfig);
|
|
@@ -29,19 +29,19 @@ describe('SynchronizeValeurTables unit tests', () => {
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const valeurTablesData = ValeurTablesFixture.aValeurTableExample();
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
vi.spyOn(ApplicationConfig.prototype, 'ademeValeurTablesFileUrl', 'get').mockReturnValue(
|
|
33
|
+
'http://localhost/file.xlsx'
|
|
34
|
+
);
|
|
35
|
+
vi.spyOn(ApplicationConfig.prototype, 'assetsOutputFolder', 'get').mockReturnValue(
|
|
36
|
+
'src/assets'
|
|
37
|
+
);
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
vi.spyOn(fileStore, 'downloadXlsxFileAndConvertToJson').mockResolvedValue(valeurTablesData);
|
|
40
|
+
vi.spyOn(fileStore, 'writeFileToLocalSystem').mockResolvedValue(null);
|
|
41
|
+
vi.spyOn(synchronizeC1Tables, 'execute').mockResolvedValue({});
|
|
42
|
+
vi.spyOn(synchronizeSolicitationTables, 'execute').mockResolvedValue({});
|
|
43
|
+
vi.spyOn(synchronizeDpeGesLimitValuesTables, 'execute').mockResolvedValue({});
|
|
44
|
+
vi.spyOn(addAdditionnalUeValuesTables, 'execute').mockResolvedValue({});
|
|
45
45
|
|
|
46
46
|
return synchronizeValeurTables.execute().then(() => {
|
|
47
47
|
expect(fileStore.downloadXlsxFileAndConvertToJson).toHaveBeenCalled();
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { FileStore } from './file.store.js';
|
|
2
|
+
import { describe, expect, test, vi } from 'vitest';
|
|
2
3
|
|
|
3
|
-
global.fetch =
|
|
4
|
+
global.fetch = vi.fn(() =>
|
|
4
5
|
Promise.resolve({
|
|
5
6
|
arrayBuffer: () => Promise.resolve(new ArrayBuffer(1))
|
|
6
7
|
})
|
|
7
8
|
);
|
|
8
9
|
|
|
9
10
|
describe('FileStore unit tests', () => {
|
|
10
|
-
|
|
11
|
+
test('should be able to download and parse an xlsx file', () => {
|
|
11
12
|
const fileStore = new FileStore();
|
|
12
13
|
|
|
13
14
|
return fileStore.downloadXlsxFileAndConvertToJson('http://localhost:8080').then((output) => {
|
|
@@ -15,7 +16,7 @@ describe('FileStore unit tests', () => {
|
|
|
15
16
|
});
|
|
16
17
|
});
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
test('should be able to read and parse local ods file', () => {
|
|
19
20
|
const fileStore = new FileStore();
|
|
20
21
|
|
|
21
22
|
return fileStore.readLocalOdsFileAndConvertToJson('file.ods').then((output) => {
|
|
@@ -23,7 +24,7 @@ describe('FileStore unit tests', () => {
|
|
|
23
24
|
});
|
|
24
25
|
});
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
test('should write file to local system', () => {
|
|
27
28
|
const fileStore = new FileStore();
|
|
28
29
|
return fileStore.writeFileToLocalSystem('src/output.js', 'filecontent');
|
|
29
30
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { TvsStore } from './tvs.store.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
2
3
|
|
|
3
4
|
describe('TvsStore unit tests', () => {
|
|
4
|
-
|
|
5
|
+
test('should get rendement distribution ch id', () => {
|
|
5
6
|
const store = new TvsStore();
|
|
6
7
|
|
|
7
8
|
expect(store.getRendementDistributionCh('41', '0')).toMatchObject({
|
|
@@ -24,7 +25,7 @@ describe('TvsStore unit tests', () => {
|
|
|
24
25
|
});
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
test('should get rendement distribution ch by id', () => {
|
|
28
29
|
const store = new TvsStore();
|
|
29
30
|
|
|
30
31
|
expect(store.getRendementDistributionChById('10')).toMatchObject({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ObjectUtil } from './object-util.js';
|
|
2
|
+
import { describe, expect, test } from 'vitest';
|
|
2
3
|
|
|
3
4
|
describe('ObjectUtil unit tests', () => {
|
|
4
|
-
|
|
5
|
+
test('should be able to deeply transform an object keys and values', () => {
|
|
5
6
|
expect(
|
|
6
7
|
ObjectUtil.deepObjectTransform(
|
|
7
8
|
{ key1: 'Value1', key2: 'Value2', nested: [{ key3: 'Value3' }] },
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createLogger, format, transports } from 'winston';
|
|
2
|
+
|
|
3
|
+
const { combine, timestamp, prettyPrint, colorize, errors, printf } = format;
|
|
4
|
+
|
|
5
|
+
// Disable traditional console logs
|
|
6
|
+
const copyLog = console.log;
|
|
7
|
+
const copyWarn = console.warn;
|
|
8
|
+
const copyDebug = console.debug;
|
|
9
|
+
const copyError = console.error;
|
|
10
|
+
|
|
11
|
+
export const logger = createLogger({
|
|
12
|
+
level: 'info',
|
|
13
|
+
format: combine(
|
|
14
|
+
errors({ stack: true }),
|
|
15
|
+
colorize(),
|
|
16
|
+
timestamp(),
|
|
17
|
+
prettyPrint(),
|
|
18
|
+
printf(({ level, message, timestamp, stack }) => {
|
|
19
|
+
if (stack) {
|
|
20
|
+
// print log trace
|
|
21
|
+
return `${timestamp} ${level}: ${message} - ${stack}`;
|
|
22
|
+
}
|
|
23
|
+
return `${timestamp} ${level}: ${message}`;
|
|
24
|
+
})
|
|
25
|
+
),
|
|
26
|
+
transports: [new transports.Console()]
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const setLoggerOff = (ignoreErrors = false) => {
|
|
30
|
+
logger.silent = true;
|
|
31
|
+
console.log = () => {};
|
|
32
|
+
console.warn = () => {};
|
|
33
|
+
console.debug = () => {};
|
|
34
|
+
if (ignoreErrors) {
|
|
35
|
+
console.error = () => {};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const setLoggerOn = (errorsIgnored = false) => {
|
|
40
|
+
logger.silent = false;
|
|
41
|
+
console.log = copyLog;
|
|
42
|
+
console.warn = copyWarn;
|
|
43
|
+
console.debug = copyDebug;
|
|
44
|
+
if (errorsIgnored) {
|
|
45
|
+
console.error = copyError;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DE } from './dpe.model';
|
|
2
|
+
|
|
3
|
+
export interface BaieEts {
|
|
4
|
+
donnee_entree?: BaieEtsDE;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface BaieEtsDE extends DE {
|
|
8
|
+
enum_orientation_id?: number;
|
|
9
|
+
enum_inclinaison_vitrage_id?: number; // ENUM inclinaison_vitrage
|
|
10
|
+
surface_totale_baie?: number;
|
|
11
|
+
nb_baie?: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { DE } from './dpe.model';
|
|
2
|
+
|
|
3
|
+
export interface BaieVitree {
|
|
4
|
+
donnee_entree?: BaieVitreeDE;
|
|
5
|
+
donnee_intermediaire?: BaieVitreeDI;
|
|
6
|
+
baie_vitree_double_fenetre?: BaieVitreeDoubleFenetre;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BaieVitreeDE extends DE {
|
|
10
|
+
reference_paroi?: string;
|
|
11
|
+
reference_lnc?: string;
|
|
12
|
+
tv_coef_reduction_deperdition_id?: string; // TV
|
|
13
|
+
surface_aiu?: number;
|
|
14
|
+
surface_aue?: number;
|
|
15
|
+
enum_cfg_isolation_lnc_id?: string; // ENUM cfg_isolation_lnc
|
|
16
|
+
enum_type_adjacence_id?: string; // ENUM type_adjacence
|
|
17
|
+
surface_totale_baie?: number;
|
|
18
|
+
nb_baie?: number;
|
|
19
|
+
tv_ug_id?: string; // TV
|
|
20
|
+
enum_type_vitrage_id?: string; // ENUM type_vitrage
|
|
21
|
+
enum_inclinaison_vitrage_id?: string; // ENUM inclinaison_vitrage
|
|
22
|
+
enum_type_gaz_lame_id?: string; // ENUM type_gaz_lame
|
|
23
|
+
epaisseur_lame?: number;
|
|
24
|
+
vitrage_vir?: boolean;
|
|
25
|
+
enum_methode_saisie_perf_vitrage_id?: string; // ENUM methode_saisie_perf_vitrage
|
|
26
|
+
ug_saisi?: number;
|
|
27
|
+
tv_uw_id?: string;
|
|
28
|
+
enum_type_materiaux_menuiserie_id?: string; // ENUM type_materiaux_menuiserie
|
|
29
|
+
enum_type_baie_id?: string; // ENUM type_baie
|
|
30
|
+
uw_saisi?: number;
|
|
31
|
+
double_fenetre?: boolean;
|
|
32
|
+
uw_1?: number;
|
|
33
|
+
sw_1?: number;
|
|
34
|
+
uw_2?: number;
|
|
35
|
+
sw_2?: number;
|
|
36
|
+
tv_deltar_id?: string;
|
|
37
|
+
tv_ujn_id?: string;
|
|
38
|
+
enum_type_fermeture_id?: string;
|
|
39
|
+
presence_protection_solaire_hors_fermeture?: boolean;
|
|
40
|
+
ujn_saisi?: number;
|
|
41
|
+
presence_retour_isolation?: boolean;
|
|
42
|
+
presence_joint?: boolean;
|
|
43
|
+
largeur_dormant?: number;
|
|
44
|
+
tv_sw_id?: string;
|
|
45
|
+
sw_saisi?: number;
|
|
46
|
+
enum_type_pose_id?: string; // ENUM type_pose
|
|
47
|
+
enum_orientation_id?: string;
|
|
48
|
+
tv_coef_masque_proche_id?: string;
|
|
49
|
+
tv_coef_masque_lointain_homogene_id?: string;
|
|
50
|
+
masque_lointain_non_homogene_collection: {
|
|
51
|
+
masque_lointain_non_homogene: {
|
|
52
|
+
tv_coef_masque_lointain_non_homogene_id?: string; // TV
|
|
53
|
+
};
|
|
54
|
+
}[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface BaieVitreeDI {
|
|
58
|
+
b: number;
|
|
59
|
+
ug?: number;
|
|
60
|
+
uw: number;
|
|
61
|
+
ujn?: number;
|
|
62
|
+
u_menuiserie: number;
|
|
63
|
+
sw: number;
|
|
64
|
+
fe1: number;
|
|
65
|
+
fe2: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface BaieVitreeDoubleFenetre {
|
|
69
|
+
donnee_entree?: BaieVitreeDoubleFenetreDE;
|
|
70
|
+
donnee_intermediaire?: BaieVitreeDoubleFenetreDI;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface BaieVitreeDoubleFenetreDE {
|
|
74
|
+
tv_ug_id?: string;
|
|
75
|
+
enum_type_vitrage_id: string;
|
|
76
|
+
enum_inclinaison_vitrage_id: string;
|
|
77
|
+
enum_type_gaz_lame_id?: string;
|
|
78
|
+
epaisseur_lame?: number;
|
|
79
|
+
vitrage_vir?: boolean;
|
|
80
|
+
enum_methode_saisie_perf_vitrage_id: string;
|
|
81
|
+
ug_saisi?: number;
|
|
82
|
+
tv_uw_id?: string;
|
|
83
|
+
enum_type_materiaux_menuiserie_id: string;
|
|
84
|
+
enum_type_baie_id: string;
|
|
85
|
+
uw_saisi?: number;
|
|
86
|
+
tv_sw_id?: string;
|
|
87
|
+
sw_saisi?: number;
|
|
88
|
+
enum_type_pose_id: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface BaieVitreeDoubleFenetreDI {
|
|
92
|
+
ug?: number;
|
|
93
|
+
uw: number;
|
|
94
|
+
sw: number;
|
|
95
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DE } from './dpe.model';
|
|
2
|
+
|
|
3
|
+
export interface Climatisation {
|
|
4
|
+
donnee_entree?: ClimatisationDE;
|
|
5
|
+
donnee_intermediaire?: ClimatisationDI;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ClimatisationDE extends DE {
|
|
9
|
+
tv_seer_id?: number;
|
|
10
|
+
nombre_logement_echantillon?: number;
|
|
11
|
+
enum_methode_calcul_conso_id: number;
|
|
12
|
+
enum_periode_installation_fr_id: number;
|
|
13
|
+
cle_repartition_clim?: number;
|
|
14
|
+
enum_type_generateur_fr_id: number;
|
|
15
|
+
enum_type_energie_id?: number;
|
|
16
|
+
enum_methode_saisie_carac_sys_id: number;
|
|
17
|
+
ref_produit_fr?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ClimatisationDI {
|
|
21
|
+
eer: number;
|
|
22
|
+
besoin_fr: number;
|
|
23
|
+
conso_fr: number;
|
|
24
|
+
conso_fr_depensier: number;
|
|
25
|
+
}
|