]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor: use `OCPP20MessageFormatEnumType` instead of string literal union
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Mar 2026 16:43:03 +0000 (17:43 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Mar 2026 16:43:03 +0000 (17:43 +0100)
src/charging-station/ocpp/auth/types/AuthTypes.ts
tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts

index 414fc093243cc5dadb2461232dba7c64f6ec47fa..a96625d5fdd57debd236a772c08b3b4090edb42d 100644 (file)
@@ -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
   }
 
index 64a6c5562c1dbb7b66f73dfebe48f2a13c80765b..ba032bfe9940d50261e582aea02d368c4183a0d2 100644 (file)
@@ -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'),