From e56c38f3b78cb77969a088e33adaa3e4543afb22 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Fri, 26 Apr 2019 11:17:41 +0200
Subject: [PATCH] Updated tests for Karma

---
 spec/session/serialisation.spec.ts            |  10 +-
 spec/session/session-OUV.json                 | 101 ------------------
 spec/session/session-RU.json                  |   1 -
 spec/value_ref/value_ref_indirect.spec.ts     |   2 +-
 spec/value_ref/value_ref_section.spec.ts      |   2 +-
 .../value_ref/value_ref_target_status.spec.ts |   2 +-
 spec/value_ref/value_ref_type_section.spec.ts |   2 +-
 .../value_ref_variable_extraresult.spec.ts    |   2 +-
 8 files changed, 10 insertions(+), 112 deletions(-)
 delete mode 100644 spec/session/session-OUV.json
 delete mode 100644 spec/session/session-RU.json

diff --git a/spec/session/serialisation.spec.ts b/spec/session/serialisation.spec.ts
index e3a7df12..0ecd68a2 100644
--- a/spec/session/serialisation.spec.ts
+++ b/spec/session/serialisation.spec.ts
@@ -1,5 +1,5 @@
-import { ParamValueMode, SectionParametree, Session } from "../../src";
 import { ConduiteDistrib, ConduiteDistribParams } from "../../src/cond_distri";
+import { ParamValueMode, SectionParametree, Session } from "../../src/index";
 import { CourbeRemous, CourbeRemousParams, MethodeResolution } from "../../src/remous";
 import { cSnCirc, ParamsSectionCirc } from "../../src/section/section_circulaire";
 import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez";
@@ -139,9 +139,9 @@ describe("serialising / deserialising session - ", () => {
     });
 
     it ("loaded serialized RegimeUniforme should be calculable", () => {
-        const fs = require("fs");
         Session.getInstance().clear();
-        const session = fs.readFileSync(__dirname + "/../../../spec/session/session-RU.json", { encoding: "utf8" });
+        // tslint:disable-next-line:max-line-length
+        const session = `{"session":[{"uid":"YTEwZG","props":{"calcType":3,"nodeType":2},"meta":{"title":"R. uniforme"},"children":[{"uid":"NDcxN3","props":{"calcType":14,"nodeType":2},"children":[],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"CALCUL"},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.89},{"symbol":"LargeurBerge","mode":"SINGLE","value":2.5}]}],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001}]}]}`;
         Session.getInstance().unserialise(session);
 
         expect(Session.getInstance().getNumberOfNubs()).toBe(1);
@@ -165,9 +165,9 @@ describe("serialising / deserialising session - ", () => {
     });
 
     it ("loaded serialized Ouvrages should be calculable", () => {
-        const fs = require("fs");
         Session.getInstance().clear();
-        const session = fs.readFileSync(__dirname + "/../../../spec/session/session-OUV.json", { encoding: "utf8" });
+        // tslint:disable-next-line:max-line-length
+        const session = `{"session":[{"uid":"NGVzdz","props":{"calcType":8,"nodeType":0},"meta":{"title":"Ouvrages"},"children":[{"uid":"Z2F4dz","props":{"calcType":7,"nodeType":5,"structureType":1,"loiDebit":1},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"SINGLE","value":0.5},{"symbol":"L","mode":"SINGLE","value":2},{"symbol":"Cd","mode":"SINGLE","value":0.6}]},{"uid":"ZDR4cX","props":{"calcType":7,"nodeType":5,"structureType":1,"loiDebit":1},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"SINGLE","value":0.5},{"symbol":"L","mode":"CALCUL"},{"symbol":"Cd","mode":"SINGLE","value":0.6}]}],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Q","mode":"SINGLE","value":3.5},{"symbol":"Z1","mode":"SINGLE","value":102},{"symbol":"Z2","mode":"SINGLE","value":101.5}]}]}`;
         Session.getInstance().unserialise(session);
 
         expect(Session.getInstance().getNumberOfNubs()).toBe(1);
diff --git a/spec/session/session-OUV.json b/spec/session/session-OUV.json
deleted file mode 100644
index 52309305..00000000
--- a/spec/session/session-OUV.json
+++ /dev/null
@@ -1,101 +0,0 @@
-{
-    "session": [
-        {
-            "uid": "NGVzdz",
-            "props": {
-                "calcType": 8,
-                "nodeType": 0
-            },
-            "meta": {
-                "title": "Ouvrages"
-            },
-            "children": [
-                {
-                    "uid": "Z2F4dz",
-                    "props": {
-                        "calcType": 7,
-                        "nodeType": 5,
-                        "structureType": 1,
-                        "loiDebit": 1
-                    },
-                    "children": [],
-                    "parameters": [
-                        {
-                            "symbol": "ZDV",
-                            "mode": "SINGLE",
-                            "value": 100
-                        },
-                        {
-                            "symbol": "W",
-                            "mode": "SINGLE",
-                            "value": 0.5
-                        },
-                        {
-                            "symbol": "L",
-                            "mode": "SINGLE",
-                            "value": 2
-                        },
-                        {
-                            "symbol": "Cd",
-                            "mode": "SINGLE",
-                            "value": 0.6
-                        }
-                    ]
-                },
-                {
-                    "uid": "ZDR4cX",
-                    "props": {
-                        "calcType": 7,
-                        "nodeType": 5,
-                        "structureType": 1,
-                        "loiDebit": 1
-                    },
-                    "children": [],
-                    "parameters": [
-                        {
-                            "symbol": "ZDV",
-                            "mode": "SINGLE",
-                            "value": 100
-                        },
-                        {
-                            "symbol": "W",
-                            "mode": "SINGLE",
-                            "value": 0.5
-                        },
-                        {
-                            "symbol": "L",
-                            "mode": "CALCUL"
-                        },
-                        {
-                            "symbol": "Cd",
-                            "mode": "SINGLE",
-                            "value": 0.6
-                        }
-                    ]
-                }
-            ],
-            "parameters": [
-                {
-                    "symbol": "Pr",
-                    "mode": "SINGLE",
-                    "value": 0.0001
-                },
-                {
-                    "symbol": "Q",
-                    "mode": "SINGLE",
-                    "value": 3.5
-                },
-                {
-                    "symbol": "Z1",
-                    "mode": "SINGLE",
-                    "value": 102
-                },
-                {
-                    "symbol": "Z2",
-                    "mode": "SINGLE",
-                    "value": 101.5
-                }
-            ]
-        }
-    ]
-}
\ No newline at end of file
diff --git a/spec/session/session-RU.json b/spec/session/session-RU.json
deleted file mode 100644
index 8f2c6f3d..00000000
--- a/spec/session/session-RU.json
+++ /dev/null
@@ -1 +0,0 @@
-{"session":[{"uid":"YTEwZG","props":{"calcType":3,"nodeType":2},"meta":{"title":"R. uniforme"},"children":[{"uid":"NDcxN3","props":{"calcType":14,"nodeType":2},"children":[],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001},{"symbol":"Ks","mode":"SINGLE","value":40},{"symbol":"Q","mode":"CALCUL"},{"symbol":"If","mode":"SINGLE","value":0.001},{"symbol":"YB","mode":"SINGLE","value":1},{"symbol":"Y","mode":"SINGLE","value":0.89},{"symbol":"LargeurBerge","mode":"SINGLE","value":2.5}]}],"parameters":[{"symbol":"Pr","mode":"SINGLE","value":0.0001}]}]}
\ No newline at end of file
diff --git a/spec/value_ref/value_ref_indirect.spec.ts b/spec/value_ref/value_ref_indirect.spec.ts
index 4df7e9ab..9e59d876 100644
--- a/spec/value_ref/value_ref_indirect.spec.ts
+++ b/spec/value_ref/value_ref_indirect.spec.ts
@@ -1,5 +1,5 @@
 import { CreateStructure, cSnCirc, cSnTrapez, LoiDebit, ParamsSectionCirc,
-         ParamsSectionTrapez, Session } from "../../src";
+         ParamsSectionTrapez, Session } from "../../src/index";
 import { PabDimension, PabDimensionParams } from "../../src/pab/pab_dimension";
 import { RegimeUniforme } from "../../src/regime_uniforme";
 import { SectionParametree } from "../../src/section/section_parametree";
diff --git a/spec/value_ref/value_ref_section.spec.ts b/spec/value_ref/value_ref_section.spec.ts
index 8a9c89d3..50c1d19e 100644
--- a/spec/value_ref/value_ref_section.spec.ts
+++ b/spec/value_ref/value_ref_section.spec.ts
@@ -1,4 +1,4 @@
-import { CreateStructure, cSnTrapez, LoiDebit, ParamsSectionTrapez, Session } from "../../src";
+import { CreateStructure, cSnTrapez, LoiDebit, ParamsSectionTrapez, Session } from "../../src/index";
 import { SectionParametree } from "../../src/section/section_parametree";
 import { Dever, DeverParams } from "../../src/structure/dever";
 
diff --git a/spec/value_ref/value_ref_target_status.spec.ts b/spec/value_ref/value_ref_target_status.spec.ts
index 403aeb87..1d604b2d 100644
--- a/spec/value_ref/value_ref_target_status.spec.ts
+++ b/spec/value_ref/value_ref_target_status.spec.ts
@@ -6,7 +6,7 @@
  */
 // import { describe, expect, it } from "../mock_jasmine";
 
-import { Session } from "../../src";
+import { Session } from "../../src/index";
 import { PabDimension, PabDimensionParams } from "../../src/pab/pab_dimension";
 
 let nub1: PabDimension;
diff --git a/spec/value_ref/value_ref_type_section.spec.ts b/spec/value_ref/value_ref_type_section.spec.ts
index 06962608..aacf137b 100644
--- a/spec/value_ref/value_ref_type_section.spec.ts
+++ b/spec/value_ref/value_ref_type_section.spec.ts
@@ -1,5 +1,5 @@
 import { CreateStructure, cSnCirc, LinkedValue, LoiDebit, ParallelStructure, ParallelStructureParams,
-         ParamsSectionCirc, Session } from "../../src";
+         ParamsSectionCirc, Session } from "../../src/index";
 import { RegimeUniforme } from "../../src/regime_uniforme";
 import { RectangularStructureParams } from "../../src/structure/structure_cem88d";
 
diff --git a/spec/value_ref/value_ref_variable_extraresult.spec.ts b/spec/value_ref/value_ref_variable_extraresult.spec.ts
index 9ddb5aea..55df0479 100644
--- a/spec/value_ref/value_ref_variable_extraresult.spec.ts
+++ b/spec/value_ref/value_ref_variable_extraresult.spec.ts
@@ -1,5 +1,5 @@
 // tslint:disable-next-line:max-line-length
-import { CreateStructure, cSnCirc, LoiDebit, ParamsSectionCirc, Session } from "../../src";
+import { CreateStructure, cSnCirc, LoiDebit, ParamsSectionCirc, Session } from "../../src/index";
 import { RegimeUniforme } from "../../src/regime_uniforme";
 import { Dever, DeverParams } from "../../src/structure/dever";
 
-- 
GitLab