From: Jérôme Benoit Date: Wed, 1 Nov 2023 09:58:06 +0000 (+0100) Subject: test: add missing file X-Git-Tag: v1.2.24~58 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a9026868fe79171a1d57da6e3763e572a625de1e;p=e-mobility-charging-stations-simulator.git test: add missing file Signed-off-by: Jérôme Benoit --- diff --git a/tests/utils/ElectricUtils.test.ts b/tests/utils/ElectricUtils.test.ts new file mode 100644 index 00000000..449967c2 --- /dev/null +++ b/tests/utils/ElectricUtils.test.ts @@ -0,0 +1,29 @@ +import { describe, it } from 'node:test'; + +import { expect } from 'expect'; + +import { ACElectricUtils, DCElectricUtils } from '../../src/utils/ElectricUtils'; + +await describe('ElectricUtils test suite', async () => { + await it('Verify DCElectricUtils.power()', () => { + expect(DCElectricUtils.power(230, 1)).toBe(230); + }); + await it('Verify DCElectricUtils.amperage()', () => { + expect(DCElectricUtils.amperage(1, 230)).toBe(0); + }); + await it('Verify ACElectricUtils.powerTotal()', () => { + expect(ACElectricUtils.powerTotal(3, 230, 1)).toBe(690); + }); + await it('Verify ACElectricUtils.powerPerPhase()', () => { + expect(ACElectricUtils.powerPerPhase(230, 1)).toBe(230); + }); + await it('Verify ACElectricUtils.amperageTotal()', () => { + expect(ACElectricUtils.amperageTotal(3, 1)).toBe(3); + }); + await it('Verify ACElectricUtils.amperageTotalFromPower()', () => { + expect(ACElectricUtils.amperageTotalFromPower(690, 230)).toBe(3); + }); + await it('Verify ACElectricUtils.amperagePerPhaseFromPower()', () => { + expect(ACElectricUtils.amperagePerPhaseFromPower(3, 690, 230)).toBe(1); + }); +});