From 56ac4356b749023227eb5e4bf85e728f66a8341c Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Tue, 24 Sep 2019 11:33:37 +0200 Subject: [PATCH] Add useless spec --- spec/section_param/section_nubs.spec.ts | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 spec/section_param/section_nubs.spec.ts diff --git a/spec/section_param/section_nubs.spec.ts b/spec/section_param/section_nubs.spec.ts new file mode 100644 index 00000000..193f9f7e --- /dev/null +++ b/spec/section_param/section_nubs.spec.ts @@ -0,0 +1,64 @@ +import { + CalculatorType, + CourbeRemous, + cSnCirc, + cSnPuiss, + cSnTrapez, + ParamsSectionCirc, + ParamsSectionPuiss, + ParamsSectionTrapez, + Props, + SectionParametree, + Session +} from "../../src/index"; +import { RegimeUniforme } from "../../src/regime_uniforme"; + +describe("section nubs and nodeTye property", () => { + + beforeEach(() => { + Session.getInstance().clear(); + }); + + it("Section paramétrée", () => { + const sp = Session.getInstance().createSessionNub( + new Props({ calcType: CalculatorType.SectionParametree }) + ) as SectionParametree; + sp.setSection(new cSnTrapez( + new ParamsSectionTrapez(2.6, 0.55, 1.1, 42, 1.3, 0.002, 0.9) + )); + const data = Session.getInstance().serialise(); + // console.log(data); + // stringified Nub should contain only 1 occurrence of "nodeType" + const ntOcc = (data.match(/"nodeType"/g) || []).length; + expect(ntOcc).toBe(1); + }); + + it("Courbe de remous", () => { + const sp = Session.getInstance().createSessionNub( + new Props({ calcType: CalculatorType.CourbeRemous }) + ) as CourbeRemous; + sp.setSection(new cSnCirc( + new ParamsSectionCirc(2.6, 0.55, 42, 1.3, 0.002, 1.1) + )); + const data = Session.getInstance().serialise(); + // console.log(data); + // stringified Nub should contain only 1 occurrence of "nodeType" + const ntOcc = (data.match(/"nodeType"/g) || []).length; + expect(ntOcc).toBe(1); + }); + + it("Régime uniforme", () => { + const sp = Session.getInstance().createSessionNub( + new Props({ calcType: CalculatorType.RegimeUniforme }) + ) as RegimeUniforme; + sp.setSection(new cSnPuiss( + new ParamsSectionPuiss(0.35, 2.6, 0.55, 1.1, 42, 1.3, 0.002) + )); + const data = Session.getInstance().serialise(); + // console.log(data); + // stringified Nub should contain only 1 occurrence of "nodeType" + const ntOcc = (data.match(/"nodeType"/g) || []).length; + expect(ntOcc).toBe(1); + }); + +}); -- GitLab