Commit 59345729 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

autoformat spec files #227

parent b018b669
......@@ -45,7 +45,7 @@ function macroRugoInstanceEmergentCd15(): MacroRugo {
);
}
const macroRugoExtraResultEmergentCd15: { [key: string]: number|MacroRugoFlowType } = {
const macroRugoExtraResultEmergentCd15: { [key: string]: number | MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
Fr: 0.530425,
PV: 242.174003,
......@@ -86,7 +86,7 @@ function macroRugoInstanceEmergentCd2(): MacroRugo {
return nub;
}
const macroRugoExtraResultEmergentCd2: { [key: string]: number|MacroRugoFlowType } = {
const macroRugoExtraResultEmergentCd2: { [key: string]: number | MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
Fr: 0.404817,
PV: 184.825731,
......@@ -125,7 +125,7 @@ function macroRugoInstanceSubmerged(): MacroRugo {
return nub;
}
const macroRugoExtraResultSubmerged: { [key: string]: number|MacroRugoFlowType } = {
const macroRugoExtraResultSubmerged: { [key: string]: number | MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.SUBMERGED,
Fr: 0.776130,
PV: 545.564782,
......@@ -160,19 +160,19 @@ function MacroRugoFactory(sInstance: string): MacroRugo {
}
function testMacroRugo(sInstance: string, varTest: string, valRef: number) {
it(`Calc(${varTest}) should be ${valRef}`, () => {
const nub = MacroRugoFactory(sInstance);
nub.prms.Q.v = nub.Calc("Q").vCalc;
const p = nub.getParameter(varTest);
p.v = undefined;
p.valueMode = ParamValueMode.CALCUL;
const r = nub.Calc(varTest, 0.1);
checkResult(r, valRef);
});
it(`Calc(${varTest}) should be ${valRef}`, () => {
const nub = MacroRugoFactory(sInstance);
nub.prms.Q.v = nub.Calc("Q").vCalc;
const p = nub.getParameter(varTest);
p.v = undefined;
p.valueMode = ParamValueMode.CALCUL;
const r = nub.Calc(varTest, 0.1);
checkResult(r, valRef);
});
}
function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExtraRes: { [key: string]: number }) {
describe(`Condition ${sInstance}` , () => {
describe(`Condition ${sInstance}`, () => {
it(`resolveQ(${Q0}) should be ${fVal0}`, () => {
const nubit = MacroRugoFactory(sInstance);
nubit.prms.Q.v = Q0;
......@@ -191,7 +191,7 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt
if (mrExtraRes.hasOwnProperty(sExtraRes)) {
it(`${sExtraRes} should be ${mrExtraRes[sExtraRes]}`, () => {
expect(MacroRugoFactory(sInstance).Calc("Q").values[sExtraRes])
.toBeCloseTo(mrExtraRes[sExtraRes], 5);
.toBeCloseTo(mrExtraRes[sExtraRes], 5);
});
}
}
......@@ -225,7 +225,7 @@ describe("Class MacroRugo: ", () => {
const nubMR2 = macroRugoInstanceJalHyd85();
nubMR.prms.Y.setValues(0.7, 1.2, 0.1);
const aQ: number[] = [ 0.484255, 0.578363, 1.004229, 1.280269, 1.618937, 2.018687 ];
const aQ: number[] = [0.484255, 0.578363, 1.004229, 1.280269, 1.618937, 2.018687];
nubMR.CalcSerie();
for (let i = 0; i < aQ.length; i++) {
......
......@@ -6,14 +6,14 @@ import { checkResult } from "../../test_func";
let sect: cSnCirc;
const resultSectCirc: {[name: string]: number} = {
const resultSectCirc: { [name: string]: number } = {
Hs: 0.853, Hsc: 0.694, B: 1.959, P: 2.738, S: 1.173, R: 0.428, V: 1.023,
Fr: 0.422, Yc: 0.512, Yn: 0.976, Ycor: 0.361, Ycon: 0.307, J: 0.002,
'I-J': -0.00102, Imp: 5076.304, Tau0: 8.505
}
describe("Section paramétrée circulaire ouverte: ", () => {
beforeEach(() =>{
beforeEach(() => {
SessionSettings.precision = precDist;
});
......@@ -31,11 +31,11 @@ describe("Section paramétrée circulaire ouverte: ", () => {
);
});
for(const v in resultSectCirc) {
for (const v in resultSectCirc) {
if (resultSectCirc.hasOwnProperty(v))
it(`${v} should equal to ${resultSectCirc[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCirc[v]);
});
it(`${v} should equal to ${resultSectCirc[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCirc[v]);
});
}
});
......@@ -54,24 +54,24 @@ describe("Section paramétrée circulaire ouverte: ", () => {
);
});
const resultSectCircDeb: {[name: string]: number} = {
const resultSectCircDeb: { [name: string]: number } = {
Hs: 2.006, Hsc: 0.694, B: 2, P: Math.PI + 2, S: Math.PI / 2 + 2, R: 0.694, V: 0.336,
Fr: 0.08, Yc: 0.512, Yn: 0.976, Ycor: 0.232, Ycon: 0.24, J: 0.0001,
'I-J': 0.001, Imp: 6943.271, Tau0: 0.782
}
for(const v in resultSectCircDeb) {
for (const v in resultSectCircDeb) {
if (resultSectCircDeb.hasOwnProperty(v))
it(`${v} should equal to ${resultSectCircDeb[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCircDeb[v]);
});
it(`${v} should equal to ${resultSectCircDeb[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCircDeb[v]);
});
}
});
});
describe("Section paramétrée circulaire fermée: ", () => {
beforeEach(() =>{
beforeEach(() => {
SessionSettings.precision = precDist;
});
......@@ -89,11 +89,11 @@ describe("Section paramétrée circulaire fermée: ", () => {
);
});
for(const v in resultSectCirc) {
for (const v in resultSectCirc) {
if (resultSectCirc.hasOwnProperty(v))
it(`${v} should equal to ${resultSectCirc[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCirc[v]);
});
it(`${v} should equal to ${resultSectCirc[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCirc[v]);
});
}
});
});
......@@ -30,7 +30,7 @@ function getCloisonsTest(): Cloisons {
describe("Class Cloisons: ", () => {
describe("Calc(Q) Fente noyée (Larinier 1992)", () => {
let c: Cloisons;
beforeEach( () => {
beforeEach(() => {
c = getCloisonsTest();
});
it("vCalc should return 0.47", () => {
......
......@@ -26,7 +26,7 @@ describe("Class PabChute: ", () => {
pabChuteTest("Z2", 0.5);
pabChuteTest("DH", 1.5);
it ("Z1 < Z2 should lead to log error entry", () => {
it("Z1 < Z2 should lead to log error entry", () => {
const prms = new PabChuteParams(
100, // Cote amont Z1
100.5, // Cote aval Z2
......
......@@ -882,7 +882,7 @@ describe("Pab", () => {
]
}`;
Session.getInstance().unserialise(sessionJson);
const nub = Session.getInstance().findNubByUid("cnBhOW") as Pab;
const nub = Session.getInstance().findNubByUid("cnBhOW") as Pab;
expect(nub.CalcSerie().ok).toBe(true);
});
});
......
......@@ -7,7 +7,7 @@ describe("Pab", () => {
const sessionJson = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-01-29T10:53:53.412Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"NzM5YT","props":{"calcType":"Pab"},"meta":{"title":"Doubs-Orchamps-ARTELIA 1"},"children":[{"uid":"bmxzdD","props":{"calcType":"Cloisons"},"children":[{"uid":"Y3hwc2","props":{"calcType":"Structure","structureType":"SeuilTriangulaireTrunc","loiDebit":"TriangularTruncWeirFree"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":208.5},{"symbol":"BT","mode":"SINGLE","value":2.4},{"symbol":"ZT","mode":"SINGLE","value":209.3},{"symbol":"CdT","mode":"SINGLE","value":1.36}]},{"uid":"a3k0Y2","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":208},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.39}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":5.2},{"symbol":"BB","mode":"SINGLE","value":6},{"symbol":"ZRMB","mode":"SINGLE","value":207},{"symbol":"ZRAM","mode":"SINGLE","value":207.1},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"ajhyaH","props":{"calcType":"Cloisons"},"children":[{"uid":"YnUxcX","props":{"calcType":"Structure","structureType":"SeuilTriangulaireTrunc","loiDebit":"TriangularTruncWeirFree"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":207.25},{"symbol":"BT","mode":"SINGLE","value":2.4},{"symbol":"ZT","mode":"SINGLE","value":207.9},{"symbol":"CdT","mode":"SINGLE","value":1.36}]},{"uid":"eTU3Zm","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":206.1},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.39}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":4.2},{"symbol":"BB","mode":"SINGLE","value":6},{"symbol":"ZRMB","mode":"SINGLE","value":205.5},{"symbol":"ZRAM","mode":"SINGLE","value":205.55},{"symbol":"QA","mode":"SINGLE","value":0}]}],"parameters":[{"symbol":"Q","mode":"CALCUL","value":1.317},{"symbol":"Z1","mode":"LISTE","values":[208.72,208.76],"extensionStrategy":0},{"symbol":"Z2","mode":"LISTE","values":[206.34,206.59],"extensionStrategy":0}],"downWall":{"uid":"ZTkwOD","props":{"calcType":"CloisonAval"},"children":[{"uid":"cjJuYX","props":{"calcType":"Structure","structureType":"SeuilTriangulaireTrunc","loiDebit":"TriangularTruncWeirFree"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":207.2},{"symbol":"BT","mode":"SINGLE","value":2.4},{"symbol":"ZT","mode":"SINGLE","value":207.9},{"symbol":"CdT","mode":"SINGLE","value":1.36}]},{"uid":"YTA0ND","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":205.7},{"symbol":"L","mode":"SINGLE","value":1.2},{"symbol":"CdWR","mode":"SINGLE","value":0.39}]}],"parameters":[{"symbol":"ZRAM","mode":"SINGLE","value":205.45}]}}]}`;
Session.getInstance().clear();
Session.getInstance().unserialise(sessionJson);
const nub = Session.getInstance().findNubByUid("NzM5YT") as Pab;
const nub = Session.getInstance().findNubByUid("NzM5YT") as Pab;
const res = nub.CalcSerie();
let childIndex = 0;
// cloisons
......
......@@ -26,7 +26,7 @@ describe("Class PabNombre: ", () => {
pabNombreTest("N", 10);
pabNombreTest("DH", 0.75);
it ("DHR should be 0.3, ", () => {
it("DHR should be 0.3, ", () => {
const prms = new PabNombreParams(
7.5, // Chute totale DHT
666, // Nombre de bassins N
......@@ -44,7 +44,7 @@ describe("Class PabNombre: ", () => {
expect(nub.result.getValue("DHH")).toBeCloseTo(0.75, 3);
});
it ("DHR should be 0, NB, NH, DHB and DHH should not be defined", () => {
it("DHR should be 0, NB, NH, DHB and DHH should not be defined", () => {
const prms = new PabNombreParams(
3, // Chute totale DHT
666, // Nombre de bassins N
......@@ -62,7 +62,7 @@ describe("Class PabNombre: ", () => {
expect(nub.result.getValue("DHH")).toBeUndefined();
});
it ("non-integer number of basins should lead to log error entry", () => {
it("non-integer number of basins should lead to log error entry", () => {
const prms = new PabNombreParams(
3, // Chute totale DHT
4.5, // Nombre de bassins N
......@@ -74,7 +74,7 @@ describe("Class PabNombre: ", () => {
expect(nub.Calc("DH", 0).log.messages.length).toBeGreaterThan(0);
});
it ("when N is 0, NB and DHB should not be defined", () => {
it("when N is 0, NB and DHB should not be defined", () => {
const prms = new PabNombreParams(
7.5, // Chute totale DHT
666, // Nombre de bassins N
......
......@@ -8,9 +8,9 @@ describe("Class PabPuissance", () => {
it("Calc(V) should return a successful result", () => {
const nub =
Session.getInstance()
.createNub(
new Props({ calcType: CalculatorType.PabPuissance })
) as PabPuissance;
.createNub(
new Props({ calcType: CalculatorType.PabPuissance })
) as PabPuissance;
nub.prms.DH.setValue(0.227);
nub.prms.Q.setValue(1.4);
nub.prms.PV.setValue(140);
......
......@@ -28,7 +28,7 @@ function testParSimGeometry(
nb: number, ZR1: number, ZR2: number
) {
expect(res.globalLog.messages.length).toBe(logLength, "global log");
if(logCode !== undefined) {
if (logCode !== undefined) {
expect(res.globalLog.messages[0].code).toBe(logCode);
expect(res.globalLog.messages[0].extraVar.nb).toBe(logExtra);
}
......@@ -77,24 +77,28 @@ describe("Class ParSimulation −", () => {
par = new ParSimulation(prms);
par.parType = ParType.PLANE;
values = [
{ Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
{
Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
message: MessageCode.ERROR_PAR_HA_OUT_OF_RANGE
},
{ Z1: 9.9,
{
Z1: 9.9,
Q: 0.197,
h: 0.579,
ha: 0.54,
// V: 1.568, // foo-track
// regime: ParFlowRegime.SUBMERGED
},
{ Z1: 10,
{
Z1: 10,
Q: 0.257,
h: 0.667,
ha: 0.64,
// V: 1.663,
// regime: ParFlowRegime.SUBMERGED
},
{ Z1: 10.1,
{
Z1: 10.1,
Q: 0.322,
h: 0.75,
ha: 0.74,
......@@ -102,7 +106,8 @@ describe("Class ParSimulation −", () => {
// regime: ParFlowRegime.FREE
message: MessageCode.WARNING_PAR_NOT_SUBMERGED
},
{ Z1: 14, // (dans Cv3, "calcul" est "off", sous-entendant que le calcul a raté ? Mais il y a tout de même des valeurs…)
{
Z1: 14, // (dans Cv3, "calcul" est "off", sous-entendant que le calcul a raté ? Mais il y a tout de même des valeurs…)
/* vCalc: 0.549,
h: 0.937,
ha: 4.64,
......@@ -140,30 +145,35 @@ describe("Class ParSimulation −", () => {
par = new ParSimulation(prms);
par.parType = ParType.FATOU;
values = [
{ Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
{
Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
message: MessageCode.ERROR_PAR_HA_OUT_OF_RANGE
},
{ Z1: 9.9,
{
Z1: 9.9,
Q: 0.253,
h: 0.661,
ha: 0.54,
V: 1.1117
},
{ Z1: 10,
{
Z1: 10,
Q: 0.311,
h: 0.751,
ha: 0.64,
V: 1.186,
message: MessageCode.WARNING_PAR_NOT_SUBMERGED
},
{ Z1: 10.1,
{
Z1: 10.1,
Q: 0.374,
h: 0.824,
ha: 0.74,
V: 1.247,
message: MessageCode.WARNING_PAR_NOT_SUBMERGED
},
{ Z1: 14, // (dans Cv3, "calcul" est "off", sous-entendant que le calcul a raté ? Mais il y a tout de même des valeurs…)
{
Z1: 14, // (dans Cv3, "calcul" est "off", sous-entendant que le calcul a raté ? Mais il y a tout de même des valeurs…)
/* vCalc: 0.549,
h: 0.892,
ha: 4.64,
......@@ -197,24 +207,28 @@ describe("Class ParSimulation −", () => {
par = new ParSimulation(prms);
par.parType = ParType.SUPERACTIVE;
values = [
{ Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
{
Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
message: MessageCode.ERROR_PAR_HA_OUT_OF_RANGE
},
{ Z1: 9.5,
{
Z1: 9.5,
Q: 0.146,
h: 0.127,
ha: 0.14,
V: 1.072,
regime: ParFlowRegime.SUBMERGED
},
{ Z1: 10,
{
Z1: 10,
Q: 1.071,
h: 0.537,
ha: 0.64,
V: 1.759,
regime: ParFlowRegime.SUBMERGED
},
{ Z1: 10.1,
{
Z1: 10.1,
message: MessageCode.ERROR_PAR_HA_OUT_OF_RANGE
}
];
......@@ -244,31 +258,36 @@ describe("Class ParSimulation −", () => {
par = new ParSimulation(prms);
par.parType = ParType.CHEVRON;
values = [
{ Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
{
Z1: 7, // (Z1 < Z2 mais ça ne change rien dans Cv3)
message: MessageCode.ERROR_PAR_HA_OUT_OF_RANGE
},
{ Z1: 9.9,
{
Z1: 9.9,
Q: 0.796,
h: 0.336,
ha: 0.5,
V: 1.691,
regime: ParFlowRegime.SUBMERGED
},
{ Z1: 10,
{
Z1: 10,
Q: 1.049,
h: 0.404,
ha: 0.6,
V: 1.878,
regime: ParFlowRegime.SUBMERGED
},
{ Z1: 10.1,
{
Z1: 10.1,
Q: 1.321,
h: 0.473,
ha: 0.7,
V: 2.05,
regime: ParFlowRegime.FREE
},
{ Z1: 14,
{
Z1: 14,
message: MessageCode.ERROR_PAR_HA_OUT_OF_RANGE
}
];
......@@ -519,7 +538,7 @@ describe("Class ParSimulation −", () => {
const res = par.CalcSerie();
expect(res.log.messages.length).toBe(1);
expect(res.log.messages[0].code).toBe(MessageCode.ERROR_AT_LEAST_ONE_OF_THOSE_MUST_BE_DEFINED);
expect(res.log.messages[0].extraVar.variables).toEqual([ "ZR1", "ZD1" ]);
expect(res.log.messages[0].extraVar.variables).toEqual(["ZR1", "ZD1"]);
expect(res.vCalc).toBeUndefined("vCalc (Q)");
});
......@@ -531,7 +550,7 @@ describe("Class ParSimulation −", () => {
const res = par.CalcSerie();
expect(res.log.messages.length).toBe(1);
expect(res.log.messages[0].code).toBe(MessageCode.ERROR_AT_LEAST_ONE_OF_THOSE_MUST_BE_DEFINED);
expect(res.log.messages[0].extraVar.variables).toEqual([ "ZR2", "ZD2" ]);
expect(res.log.messages[0].extraVar.variables).toEqual(["ZR2", "ZD2"]);
expect(res.vCalc).toBeUndefined("vCalc (Q)");
});
......
......@@ -5,7 +5,7 @@ import { SessionSettings } from "../../src/session_settings";
import { MessageCode } from "../../src/util/message";
function getLechapt(): LechaptCalmon {
const l = new LechaptCalmon(
const l = new LechaptCalmon(
new LechaptCalmonParams(
0.3, // débit
0.5, // diamètre
......
......@@ -27,7 +27,7 @@ const cases: { o: number, f: string }[] = [
}
];
describe ("precision of formatted values (3 digits)", () => {
describe("precision of formatted values (3 digits)", () => {
for (const c of cases) {
it("", () => {
expect(formattedValue(c.o, 3)).toBe(c.f);
......
......@@ -143,7 +143,7 @@ function checkLink(param: ParamDefinition, nub: Nub, symbol: string) {
describe("serialising / deserialising session - ", () => {
it ("serialized file should contain 5 Nubs", () => {
it("serialized file should contain 5 Nubs", () => {
createEnv();
const session = Session.getInstance().serialise();
const js = JSON.parse(session);
......@@ -151,7 +151,7 @@ describe("serialising / deserialising session - ", () => {
expect(js.session.length).toBe(5);
});
it ("reloading serialized file should give 5 Nubs", () => {
it("reloading serialized file should give 5 Nubs", () => {
createEnv();
const session = Session.getInstance().serialise();
......@@ -162,7 +162,7 @@ describe("serialising / deserialising session - ", () => {
expect(Session.getInstance().getNumberOfNubs()).toBe(5);
});
it ("serialized files should contain 8 LINK parameters", () => {
it("serialized files should contain 8 LINK parameters", () => {
createEnv();
dever.addChild(CreateStructure(LoiDebit.RectangularOrificeFree, dever, false));
// define links
......@@ -224,7 +224,7 @@ describe("serialising / deserialising session - ", () => {
expect(serialised).toContain('{"symbol":"Ks","mode":"SINGLE","value":42}');
});
it ("loaded serialized RegimeUniforme should be calculable", () => {
it("loaded serialized RegimeUniforme should be calculable", () => {
Session.getInstance().clear();
// 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":"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":[]}]}`;
......@@ -250,7 +250,7 @@ describe("serialising / deserialising session - ", () => {
expect(RU.result).toBeDefined();
});
it ("loaded serialized Ouvrages should be calculable", () => {
it("loaded serialized Ouvrages should be calculable", () => {
Session.getInstance().clear();
// 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}]},{"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"}]}],"parameters":[{"symbol":"Q","mode":"SINGLE","value":3.5},{"symbol":"Z1","mode":"SINGLE","value":102},{"symbol":"Z2","mode":"SINGLE","value":101.5}]}]}`;
......@@ -277,7 +277,7 @@ describe("serialising / deserialising session - ", () => {
expect(OUV.result.vCalc).toBeCloseTo(1.031);
});
it ("loaded serialized spaghetti session should have the right target for every link", () => {
it("loaded serialized spaghetti session should have the right target for every link", () => {
Session.getInstance().clear();
Session.getInstance().unserialise(JSON.stringify(sessionSpaghetti));
......@@ -316,7 +316,7 @@ describe("serialising / deserialising session - ", () => {
});
it ("nghyd#263 - errors without consequences should not appear", () => {
it("nghyd#263 - errors without consequences should not appear", () => {
Session.getInstance().clear();
// tslint:disable-next-line:max-line-length
const json = `{"header":{"source":"jalhyd","format_version":"1.1","created":"2019-07-31T12:08:20.284Z"},"session":[{"uid":"NjdmM3","props":{"calcType":"PabChute","nodeType":"None"},"meta":{"title":"PAB : chute"},"children":[],"parameters":[{"symbol":"Z1","mode":"SINGLE","value":29.99},{"symbol":"Z2","mode":"SINGLE","value":26.81},{"symbol":"DH","mode":"CALCUL"}]},{"uid":"eWNjdG","props":{"calcType":"PabNombre","nodeType":"None"},"meta":{"title":"PAB : nombre"},"children":[],"parameters":[{"symbol":"DHT","mode":"LINK","targetNub":"NjdmM3","targetParam":"DH"},{"symbol":"N","mode":"SINGLE","value":14},{"symbol":"DH","mode":"CALCUL"}]},{"uid":"dXM4em","props":{"calcType":"PabPuissance","nodeType":"None"},"meta":{"title":"PAB : puissance"},"children":[],"parameters":[{"symbol":"DH","mode":"LINK","targetNub":"eWNjdG","targetParam":"DH"},{"symbol":"Q","mode":"SINGLE","value":1.8},{"symbol":"V","mode":"CALCUL"},{"symbol":"PV","mode":"SINGLE","value":140}]},{"uid":"bzNlaX","props":{"calcType":"PabDimensions","nodeType":"None"},"meta":{"title":"PAB : dimensions"},"children":[],"parameters":[{"symbol":"L","mode":"SINGLE","value":5},{"symbol":"W","mode":"SINGLE","value":3.6},{"symbol":"Y","mode":"CALCUL"},{"symbol":"V","mode":"LINK","targetNub":"dXM4em","targetParam":"V"}]},{"uid":"cGI5d3","props":{"calcType":"Cloisons","nodeType":"None"},"meta":{"title":"Cloisons"},"children":[{"uid":"ZzZzbD","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirSubmergedLarinier"},"children":[],"parameters":[{"symbol":"h1","mode":"CALCUL"},{"symbol":"L","mode":"SINGLE","value":0.5},{"symbol":"CdWSL","mode":"SINGLE","value":0.83}]}],"parameters":[{"symbol":"Q","mode":"LINK","targetNub":"dXM4em","targetParam":"Q"},{"symbol":"Z1","mode":"SINGLE","value":30.14},{"symbol":"LB","mode":"SINGLE","value":4.5},{"symbol":"BB","mode":"LINK","targetNub":"bzNlaX","targetParam":"W"},{"symbol":"PB","mode":"SINGLE","value":2.5},{"symbol":"DH","mode":"LINK","targetNub":"eWNjdG","targetParam":"DH"}]}]}`;
......@@ -324,16 +324,16 @@ describe("serialising / deserialising session - ", () => {
expect(res.hasErrors).toBe(false);
});
it ("settings should be saved in session file", () => {
it("settings should be saved in session file", () => {
Session.getInstance().clear();
SessionSettings.precision = 1e-8,
SessionSettings.maxIterations = 123;
SessionSettings.maxIterations = 123;
const serialized = Session.getInstance().serialise();
expect(serialized).toContain('"precision":1e-8');
expect(serialized).toContain('"maxIterations":123');
});
it ("settings should be restored from session file", () => {
it("settings should be restored from session file", () => {
Session.getInstance().clear();
// tslint:disable-next-line:max-line-length
const json = `{"header":{"source":"jalhyd","format_version":"1.1","created":"2019-09-12T08:46:20.079Z"},"settings":{"precision":1e-6,"maxIterations":94},"session":[]}`;
......@@ -394,7 +394,7 @@ describe("sessions containing Solveur - ", () => {
const pp = new PabPuissance(new PabPuissanceParams(666, 0.1, 0.5, 666));
pp.calculatedParam = pp.prms.PV;
Session.getInstance().clear();
Session.getInstance().registerNubs([ pc, pn, pp ]);
Session.getInstance().registerNubs([pc, pn, pp]);
pn.prms.DHT.defineReference(pc, "DH");
pp.prms.DH.defineReference(pn, "DH");
const s = new Solveur(new SolveurParams(324.907), false);
......@@ -450,11 +450,11 @@ describe("sessions containing Verificateur - ", () => {
Session.getInstance().clear();
const p = new Pab(new PabParams(1, 100, 99), new CloisonAval(new CloisonsAvalParams(1, 100, 99, 99.5)));
const e = new Espece(new EspeceParams(2));
Session.getInstance().registerNubs([ e, p ]);
Session.getInstance().registerNubs([e, p]);
const v = new Verificateur();
Session.getInstance().registerNub(v);
v.nubToVerify = p;
v.speciesList = [ "4", e.uid ];
v.speciesList = ["4", e.uid];
const serialised = Session.getInstance().serialise();
expect(serialised).toContain(`"nubToVerify":"`);
......@@ -474,7 +474,7 @@ describe("sessions containing Verificateur - ", () => {
expect(ntv.uid).toBe("MG45Yj");
const spl = verificateur.speciesList;
expect(spl).toBeDefined();
expect(spl).toEqual([ "SPECIES_2", "SPECIES_6", "SPECIES_7b", "Nms4Nn" ]);
expect(spl).toEqual(["SPECIES_2", "SPECIES_6", "SPECIES_7b", "Nms4Nn"]);
});
it("session with a Verificateur in non-last position should be loaded without errors", () => {
......@@ -490,6 +490,6 @@ describe("sessions containing Verificateur - ", () => {
expect(ntv.uid).toBe("MG45Yj");
const spl = verificateur.speciesList;
expect(spl).toBeDefined();
expect(spl).toEqual([ "SPECIES_2", "SPECIES_6", "SPECIES_7b", "Nms4Nn" ]);
expect(spl).toEqual(["SPECIES_2", "SPECIES_6", "SPECIES_7b", "Nms4Nn"]);
});
});
......@@ -4,7 +4,7 @@ import { CreateStructTest, StructureTest } from "./structure_test";
describe("Class Structure: ", () => {
let structTest: StructureTest;
beforeAll( () => {
beforeAll(() => {
structTest = CreateStructTest();
});
describe("getFlowMode()", () => {
......
......@@ -53,7 +53,7 @@ describe("Class StructureKivi: ", () => {
});
describe("Test calcul ZDV (#94):", () => {
let structTestKivi2: StructureKivi;
beforeAll( () => {
beforeAll(() => {
const kiviParams2: StructureKiviParams = new StructureKiviParams(
0.5, // Q
0, // ZDV
......
......@@ -6,7 +6,7 @@ import { itCalcQ } from "../structure/functions";
import { precDigits } from "../test_config";
function getStructTest(): StructureWeirSubmerged {
return new StructureWeirSubmerged(new RectangularStructureParams(0, 101, 102, 101.5, 0.2, 0.9), false);
return new StructureWeirSubmerged(new RectangularStructureParams(0, 101, 102, 101.5, 0.2, 0.9), false);
}
describe("Class StructureWeirSubmerged: ", () => {
......