From: Jérôme Benoit Date: Wed, 31 Jul 2024 17:06:23 +0000 (+0200) Subject: test: add getPhaseRotationValue() test X-Git-Tag: ocpp-server@v1.5.2~154 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=29971799109b0dff8f12f0977b5f520ec55cc100;p=e-mobility-charging-stations-simulator.git test: add getPhaseRotationValue() test Signed-off-by: Jérôme Benoit --- diff --git a/tests/charging-station/Helpers.test.ts b/tests/charging-station/Helpers.test.ts index 85e66adb..48c743b3 100644 --- a/tests/charging-station/Helpers.test.ts +++ b/tests/charging-station/Helpers.test.ts @@ -10,6 +10,7 @@ import { getChargingStationId, getHashId, getMaxNumberOfEvses, + getPhaseRotationValue, validateStationInfo, } from '../../src/charging-station/Helpers.js' import type { ChargingStation } from '../../src/charging-station/index.js' @@ -144,6 +145,21 @@ await describe('Helpers test suite', async () => { expect(logger.warn.mock.calls.length).toBe(1) }) + await it('Verify getPhaseRotationValue()', () => { + expect(getPhaseRotationValue(0, 0)).toBe('0.RST') + expect(getPhaseRotationValue(1, 0)).toBe('1.NotApplicable') + expect(getPhaseRotationValue(2, 0)).toBe('2.NotApplicable') + expect(getPhaseRotationValue(0, 1)).toBe('0.NotApplicable') + expect(getPhaseRotationValue(1, 1)).toBe('1.NotApplicable') + expect(getPhaseRotationValue(2, 1)).toBe('2.NotApplicable') + expect(getPhaseRotationValue(0, 2)).toBeUndefined() + expect(getPhaseRotationValue(1, 2)).toBeUndefined() + expect(getPhaseRotationValue(2, 2)).toBeUndefined() + expect(getPhaseRotationValue(0, 3)).toBe('0.RST') + expect(getPhaseRotationValue(1, 3)).toBe('1.RST') + expect(getPhaseRotationValue(2, 3)).toBe('2.RST') + }) + await it('Verify getMaxNumberOfEvses()', () => { expect(getMaxNumberOfEvses(undefined)).toBe(-1) expect(getMaxNumberOfEvses({})).toBe(0)