]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(tests): consolidate duplicate test constants
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 18:18:14 +0000 (19:18 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 18:18:14 +0000 (19:18 +0100)
- Delete duplicate OCPP20TestConstants.ts file
- Update all 21 OCPP 2.0 test files to import from canonical ChargingStationTestConstants.js
- All 7 constants verified as available in canonical source:
  * TEST_CHARGING_STATION_BASE_NAME
  * TEST_CHARGE_POINT_MODEL
  * TEST_CHARGE_POINT_SERIAL_NUMBER
  * TEST_CHARGE_POINT_VENDOR
  * TEST_FIRMWARE_VERSION
  * TEST_CONNECTOR_VALID_INSTANCE
  * TEST_CONNECTOR_INVALID_INSTANCE
- Test suite passes with 280/280 tests passing

22 files changed:
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-Reset.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent-Offline.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent-Periodic.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts
tests/charging-station/ocpp/2.0/OCPP20TestConstants.ts [deleted file]
tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts

index 8288297d3c747dd6a91e59b7c336b32e745e2326..10df46093d9b97e46f0e6c710e51d9fb9b4888cd 100644 (file)
@@ -20,7 +20,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const VALID_PEM_CERTIFICATE = `-----BEGIN CERTIFICATE-----
 MIIBkTCB+wIJAKHBfpvPA0GXMA0GCSqGSIb3DQEBCwUAMBExDzANBgNVBAMMBnRl
index 86edbab7e06cce4dba8867dbba4024f0afcea53d..d512634c7297bd2d25daa1e122bbece1fe9f589c 100644 (file)
@@ -15,7 +15,7 @@ import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/au
 import { GenericStatus, OCPPVersion } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 await describe('C11 - Clear Authorization Data in Authorization Cache', async () => {
   const mockChargingStation = createChargingStation({
index 2cbba94c7cabcb74f332b89927294836c0de7581..25b010bfb4365d1c88bb35b407f009701434a52f 100644 (file)
@@ -21,7 +21,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const VALID_CERTIFICATE_HASH_DATA = {
   hashAlgorithm: HashAlgorithmEnumType.SHA256,
index 8ad2278f351c517792cf93d5c981101f3701f63f..a8976e31dfe191b7c348b1ed6dff64accf650de6 100644 (file)
@@ -39,7 +39,7 @@ import {
   TEST_CHARGE_POINT_VENDOR,
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_FIRMWARE_VERSION,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 
 await describe('B07 - Get Base Report', async () => {
   const mockChargingStation = createChargingStation({
index fc8e5954f4f0f4f14fe8940cde7561a98578c118..5a126d71a24752167c2d5998c2d9dffbdf9bda19 100644 (file)
@@ -23,7 +23,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const createMockCertificateHashData = (serialNumber = '123456789'): CertificateHashDataType => ({
   hashAlgorithm: HashAlgorithmEnumType.SHA256,
index 59366030b2b83c55a552a3181adef23e4482c2e4..db8c9ccc7fe3156005ec8d5685d14f146ef5fde5 100644 (file)
@@ -25,7 +25,7 @@ import { createChargingStation } from '../../../ChargingStationFactory.js'
 import {
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_CONNECTOR_VALID_INSTANCE,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 import {
   resetLimits,
   resetReportingValueSize,
index d6e841dfb9b5f2f0342a7244c4c1e8a7076ebc66..9515c1e5b88897bc358e70301c2616f3f61c6b11 100644 (file)
@@ -20,7 +20,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const VALID_PEM_CERTIFICATE = `-----BEGIN CERTIFICATE-----
 MIIBkTCB+wIJAKHBfpvPA0GXMA0GCSqGSIb3DQEBCwUAMBExDzANBgNVBAMMBnRl
index 9caf893f05be031beaa48d2ba9017131b95ac1fc..bacf1a239126dbf4069e62f1e5500d2953f2943b 100644 (file)
@@ -24,7 +24,7 @@ import {
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
 import { createMockAuthService } from '../auth/helpers/MockFactories.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import {
   resetConnectorTransactionState,
   resetLimits,
index b0fe70a1e09dbbabd31c5e8d46908de29d33bfcc..e8b513d47110c378a2bbebc970470c4252dd74a0 100644 (file)
@@ -33,7 +33,7 @@ import {
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
 import { createMockAuthService } from '../auth/helpers/MockFactories.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { resetLimits, resetReportingValueSize } from './OCPP20TestUtils.js'
 
 await describe('F03 - Remote Stop Transaction', async () => {
index 4b69942e9dea75bef7c2976e843f6f08748b53df..129a9aafe753525dfc13f809b231c9a63fab472e 100644 (file)
@@ -22,7 +22,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 await describe('B11 & B12 - Reset', async () => {
   beforeEach(() => {
index 564951508ed443486861d0d98c7ff556092b666e..8a0add0c089f2e0c139bffa06a3c4330f54af061 100644 (file)
@@ -30,7 +30,7 @@ import { createChargingStation } from '../../../ChargingStationFactory.js'
 import {
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_CONNECTOR_VALID_INSTANCE,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 import {
   resetLimits,
   resetValueSizeLimits,
index 827c98bc178c26104b518c2505445bb747199faf..8dff0b816b94553a1e26b509ac1a382bd13d775c 100644 (file)
@@ -27,7 +27,7 @@ import {
   TEST_CHARGE_POINT_VENDOR,
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_FIRMWARE_VERSION,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 
 await describe('B01 - Cold Boot Charging Station', async () => {
   const mockResponseService = new OCPP20ResponseService()
index 79e0ba2b4c74dbfbb4f4e57e804a18f670e90cca..083f20fe292296085c29a0710995f71c64e2dbe4 100644 (file)
@@ -25,7 +25,7 @@ import {
   TEST_CHARGE_POINT_VENDOR,
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_FIRMWARE_VERSION,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 
 await describe('G02 - Heartbeat', async () => {
   const mockResponseService = new OCPP20ResponseService()
index 63589ef93673e8a136d996282cc5517b56f22920..583ccc21c9e752bc078e0df379687a1cd5332333 100644 (file)
@@ -29,7 +29,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 // Sample Base64 EXI request (mock - represents CertificateInstallationReq)
 const MOCK_EXI_REQUEST = 'SGVsbG8gV29ybGQgRVhJIFJlcXVlc3Q='
index 6d274d5a01a2e0ea776179a0efa07d27e0ac1f08..8075a7cef6d06ccab1f6ce4ed9976e03661696cf 100644 (file)
@@ -31,7 +31,7 @@ import {
   TEST_CHARGE_POINT_VENDOR,
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_FIRMWARE_VERSION,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 
 await describe('B07/B08 - NotifyReport', async () => {
   const mockResponseService = new OCPP20ResponseService()
index ed8c76efac046b64738e744bab75c855e4dc12f2..68924e0f50b666781a0b8c4f78ee49944544c3bb 100644 (file)
@@ -22,7 +22,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const MOCK_ORGANIZATION_NAME = 'Test Organization Inc.'
 
index 6ac27aa93c8f77470ff6f6978cc0f130a9f0fa66..cb9fe7bdff4f76c6f2afada5cf18859ed4d2f2ad 100644 (file)
@@ -26,7 +26,7 @@ import {
   TEST_STATUS_CHARGE_POINT_SERIAL_NUMBER,
   TEST_STATUS_CHARGE_POINT_VENDOR,
   TEST_STATUS_CHARGING_STATION_BASE_NAME,
-} from './OCPP20TestConstants.js'
+} from '../../ChargingStationTestConstants.js'
 
 await describe('G01 - Status Notification', async () => {
   const mockResponseService = new OCPP20ResponseService()
index 8dbdfb9153194db91463c082b2214267708eeb23..09240a59e795ae5d2c3e47794abec059b32f6289 100644 (file)
@@ -21,7 +21,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants, generateUUID } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { resetLimits } from './OCPP20TestUtils.js'
 
 await describe('E02 - OCPP 2.0.1 Offline TransactionEvent Queueing', async () => {
index 2404d4cef5300d16055966cb4ffbcab65517fcc9..2b63b98191e8db93b6309fb557a6825cc8175abd 100644 (file)
@@ -23,7 +23,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants, generateUUID } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { resetLimits } from './OCPP20TestUtils.js'
 
 await describe('E02 - OCPP 2.0.1 Periodic TransactionEvent at TxUpdatedInterval', async () => {
index 2a121271d3c42d197e32dea3f16eb8ad85682e25..4520f43270da6b139d469a2b67b62c772fb497ff 100644 (file)
@@ -24,7 +24,7 @@ import {
 } from '../../../../src/types/ocpp/2.0/Transaction.js'
 import { Constants, generateUUID } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createMockOCPP20TransactionTestStation, resetLimits } from './OCPP20TestUtils.js'
 
 await describe('E01-E04 - OCPP 2.0.1 TransactionEvent Implementation', async () => {
diff --git a/tests/charging-station/ocpp/2.0/OCPP20TestConstants.ts b/tests/charging-station/ocpp/2.0/OCPP20TestConstants.ts
deleted file mode 100644 (file)
index 92c1e57..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Common test constants for OCPP 2.0 tests
- */
-
-// Test charging station information
-export const TEST_CHARGING_STATION_BASE_NAME = 'CS-TEST'
-export const TEST_CHARGE_POINT_MODEL = 'Test Model'
-export const TEST_CHARGE_POINT_SERIAL_NUMBER = 'TEST-SN-001'
-export const TEST_CHARGE_POINT_VENDOR = 'Test Vendor'
-export const TEST_FIRMWARE_VERSION = '1.0.0'
-
-// Test connector instances
-export const TEST_CONNECTOR_VALID_INSTANCE = '1'
-export const TEST_CONNECTOR_INVALID_INSTANCE = '999'
-
-// Test charging station information for status notification tests
-export const TEST_STATUS_CHARGING_STATION_BASE_NAME = 'CS-TEST-STATUS'
-export const TEST_STATUS_CHARGE_POINT_MODEL = 'Test Status Model'
-export const TEST_STATUS_CHARGE_POINT_SERIAL_NUMBER = 'TEST-STATUS-SN-001'
-export const TEST_STATUS_CHARGE_POINT_VENDOR = 'Test Status Vendor'
index bf75a4ef3482e080ed01a71a4a2b0ab3468ded4b..031d2df22d29e3d5f8506cc8df87f2a1dc1f60cf 100644 (file)
@@ -35,7 +35,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { createChargingStation } from '../../../ChargingStationFactory.js'
-import { TEST_CHARGING_STATION_BASE_NAME } from './OCPP20TestConstants.js'
+import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import {
   resetReportingValueSize,
   resetValueSizeLimits,