]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(test): remove duplicate certificate passthrough tests from broadcast channel
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 18 Mar 2026 19:04:12 +0000 (20:04 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 18 Mar 2026 19:04:12 +0000 (20:04 +0100)
These 3 tests duplicated coverage already provided by
OCPP20RequestService-ISO15118.test.ts which tests the same code path
through the full requestHandler pipeline.

Add JSDoc descriptions to buildTransactionEvent implementation to
satisfy jsdoc/require-param-description lint rule.

src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
tests/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.test.ts

index e684ec4ac3fb5f26ea74dbdbe882e86760fde386..dd299c2ff3b5d727199baf3e0e0c26b7cac70287 100644 (file)
@@ -489,13 +489,13 @@ export function buildTransactionEvent (
   commandParams: JsonObject
 ): OCPP20TransactionEventRequest
 /**
- *
- * @param chargingStation
- * @param eventTypeOrParams
- * @param triggerReasonArg
- * @param connectorIdArg
- * @param transactionIdArg
- * @param options
+ * @param chargingStation - Charging station instance
+ * @param eventTypeOrParams - Event type enum or minimal params object
+ * @param triggerReasonArg - Trigger reason (explicit overload)
+ * @param connectorIdArg - Connector identifier (explicit overload)
+ * @param transactionIdArg - Transaction UUID (explicit overload)
+ * @param options - Optional transaction event fields
+ * @returns Built TransactionEventRequest
  */
 export function buildTransactionEvent (
   chargingStation: ChargingStation,
index 198de2a71a70d102331b50ff9167d6dc033491c5..c392a4ea85cb892a1e4a41827feb822362fc5ee8 100644 (file)
@@ -26,10 +26,7 @@ import {
 import { Constants } from '../../../src/utils/index.js'
 import { flushMicrotasks, standardCleanup } from '../../helpers/TestLifecycleHelpers.js'
 import { createMockChargingStation } from '../ChargingStationTestUtils.js'
-import {
-  createMockStationWithRequestTracking,
-  createOCPP20RequestTestContext,
-} from '../ocpp/2.0/OCPP20TestUtils.js'
+import { createMockStationWithRequestTracking } from '../ocpp/2.0/OCPP20TestUtils.js'
 
 // ============================================================================
 // Testable Interfaces
@@ -532,67 +529,6 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     })
   })
 
-  // ==========================================================================
-  // Group 3: buildRequestPayload — OCPP 2.0.1 certificate passthrough (3 tests)
-  // ==========================================================================
-
-  await describe('buildRequestPayload OCPP 2.0.1 certificate passthrough', async () => {
-    await it('should build GET_15118_EV_CERTIFICATE payload as passthrough', () => {
-      const { station, testableRequestService } = createOCPP20RequestTestContext()
-      const commandParams = {
-        action: 'Install',
-        exiRequest: 'base64EncodedData',
-        iso15118SchemaVersion: 'urn:iso:15118:2:2013:MsgDef',
-      }
-
-      const payload = testableRequestService.buildRequestPayload(
-        station,
-        RequestCommand.GET_15118_EV_CERTIFICATE,
-        commandParams
-      )
-
-      assert.deepStrictEqual(payload, commandParams)
-    })
-
-    await it('should build GET_CERTIFICATE_STATUS payload as passthrough', () => {
-      const { station, testableRequestService } = createOCPP20RequestTestContext()
-      const commandParams = {
-        ocspRequestData: {
-          hashAlgorithm: 'SHA256',
-          issuerKeyHash: 'abc123def456issuerkeyhash',
-          issuerNameHash: 'abc123def456issuernamehash',
-          responderURL: 'http://ocsp.example.com',
-          serialNumber: '1234567890',
-        },
-      }
-
-      const payload = testableRequestService.buildRequestPayload(
-        station,
-        RequestCommand.GET_CERTIFICATE_STATUS,
-        commandParams
-      )
-
-      assert.deepStrictEqual(payload, commandParams)
-    })
-
-    await it('should build SIGN_CERTIFICATE payload with generated CSR', () => {
-      const { station, testableRequestService } = createOCPP20RequestTestContext()
-      const commandParams = {
-        certificateType: 'ChargingStationCertificate',
-      }
-
-      const payload = testableRequestService.buildRequestPayload(
-        station,
-        RequestCommand.SIGN_CERTIFICATE,
-        commandParams
-      ) as { certificateType?: string; csr: string }
-
-      assert.ok(payload.csr.startsWith('-----BEGIN CERTIFICATE REQUEST-----'))
-      assert.ok(payload.csr.endsWith('-----END CERTIFICATE REQUEST-----'))
-      assert.strictEqual(payload.certificateType, 'ChargingStationCertificate')
-    })
-  })
-
   // ==========================================================================
   // Group 4: commandHandler dispatch pipeline — verify full dispatch (8 tests)
   // ==========================================================================