From 5f24ad5620a5b35d92b0db3594099eab4ffbb28a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 27 Mar 2026 17:43:03 +0100 Subject: [PATCH] refactor: use `OCPP20MessageFormatEnumType` instead of string literal union --- src/charging-station/ocpp/auth/types/AuthTypes.ts | 3 ++- tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/charging-station/ocpp/auth/types/AuthTypes.ts b/src/charging-station/ocpp/auth/types/AuthTypes.ts index 414fc093..a96625d5 100644 --- a/src/charging-station/ocpp/auth/types/AuthTypes.ts +++ b/src/charging-station/ocpp/auth/types/AuthTypes.ts @@ -1,4 +1,5 @@ import type { JsonObject, OCPPVersion } from '../../../../types/index.js' +import type { OCPP20MessageFormatEnumType } from '../../../../types/index.js' import { OCPP16AuthorizationStatus, @@ -181,7 +182,7 @@ export interface AuthorizationResult { /** Personal message for user display */ readonly personalMessage?: { content: string - format: 'ASCII' | 'HTML' | 'URI' | 'UTF8' + format: OCPP20MessageFormatEnumType language?: string } diff --git a/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts b/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts index 64a6c556..ba032bfe 100644 --- a/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts +++ b/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts @@ -14,6 +14,7 @@ import { type UnifiedIdentifier, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthHelpers } from '../../../../../src/charging-station/ocpp/auth/utils/AuthHelpers.js' +import { OCPP20MessageFormatEnumType } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthHelpers', async () => { @@ -444,7 +445,7 @@ await describe('AuthHelpers', async () => { method: AuthenticationMethod.LOCAL_LIST, personalMessage: { content: 'Welcome', - format: 'ASCII', + format: OCPP20MessageFormatEnumType.ASCII, }, status: AuthorizationStatus.ACCEPTED, timestamp: new Date('2024-01-01T00:00:00Z'), -- 2.53.0