From 29971799109b0dff8f12f0977b5f520ec55cc100 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 31 Jul 2024 19:06:23 +0200 Subject: [PATCH] test: add getPhaseRotationValue() test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/charging-station/Helpers.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) -- 2.34.1