]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(tests): migrate all test files to createMockChargingStation
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 19:34:22 +0000 (20:34 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 19:34:22 +0000 (20:34 +0100)
- Migrated 20 OCPP 2.0 test files to use createMockChargingStation
- Migrated 4 utility test files to use consolidated imports
- Added createChargingStation and createChargingStationTemplate re-exports to ChargingStationTestUtils
- All 291 tests passing

Tasks 3-7 complete

25 files changed:
tests/charging-station/ChargingStationTestUtils.ts
tests/charging-station/ConfigurationKeyUtils.test.ts
tests/charging-station/Helpers.test.ts
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.test.ts
tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts
tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts
tests/charging-station/ocpp/auth/factories/AuthComponentFactory.test.ts
tests/utils/ErrorUtils.test.ts

index 9ff67bf6c3871e4ae4aa59dc6ff28feb53795995..8b8131151d5f9e697c9be36e3bd939904f05a2e6 100644 (file)
@@ -37,6 +37,8 @@ export {
   waitForCondition,
 } from './helpers/StationHelpers.js'
 
+export { createChargingStation, createChargingStationTemplate } from '../ChargingStationFactory.js'
+
 export { MockIdTagsCache, MockSharedLRUCache } from './mocks/MockCaches.js'
 // Re-export all mock classes
 export { MockWebSocket, WebSocketReadyState } from './mocks/MockWebSocket.js'
index a9479c62b7ecbb03032fbb72b9e3a265fcdbec03..eab3f6d6eabc160191ffd2713911f6c43d9ba6a6 100644 (file)
@@ -14,7 +14,7 @@ import {
   setConfigurationKeyValue,
 } from '../../src/charging-station/ConfigurationKeyUtils.js'
 import { logger } from '../../src/utils/Logger.js'
-import { createChargingStation } from '../ChargingStationFactory.js'
+import { createChargingStation } from './ChargingStationTestUtils.js'
 
 const TEST_KEY_1 = 'TestKey1'
 const MIXED_CASE_KEY = 'MiXeDkEy'
index 341c4c7e688d74ab81fde71a2680400bca3b8a2a..70d7b9722a606e15786f42f7a99d9f3e90daf749 100644 (file)
@@ -33,7 +33,7 @@ import {
   type Reservation,
 } from '../../src/types/index.js'
 import { logger } from '../../src/utils/Logger.js'
-import { createChargingStation, createChargingStationTemplate } from '../ChargingStationFactory.js'
+import { createChargingStation, createChargingStationTemplate } from './ChargingStationTestUtils.js'
 import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 
 await describe('Helpers test suite', async () => {
index 00fb18df643cd387cfa800a2ab9cb6929c2ff336..18b3e74ac293ec61df58366e5bc633ce18883bb2 100644 (file)
@@ -24,7 +24,7 @@ import {
   OCPPVersion,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const VALID_PEM_CERTIFICATE = `-----BEGIN CERTIFICATE-----
@@ -105,12 +105,12 @@ const createMockCertificateManager = (
 })
 
 await describe('I04 - CertificateSigned', async () => {
-  let mockChargingStation: TestableChargingStationWithCertificate
+  let station: ChargingStation
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -120,9 +120,10 @@ await describe('I04 - CertificateSigned', async () => {
         ocppVersion: OCPPVersion.VERSION_201,
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
-    }) as TestableChargingStationWithCertificate
-    mockChargingStation.certificateManager = createMockCertificateManager()
-    mockChargingStation.closeWSConnection = mock.fn()
+    })
+    station = mockStation
+    station.certificateManager = createMockCertificateManager()
+    station.closeWSConnection = mock.fn()
     incomingRequestService = new OCPP20IncomingRequestService()
     testableService = createTestableIncomingRequestService(incomingRequestService)
   })
@@ -132,7 +133,7 @@ await describe('I04 - CertificateSigned', async () => {
   })
   await describe('Valid Certificate Chain Installation', async () => {
     await it('should accept valid certificate chain', async () => {
-      mockChargingStation.certificateManager = createMockCertificateManager({
+      station.certificateManager = createMockCertificateManager({
         storeCertificateResult: true,
       })
 
@@ -142,7 +143,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response).toBeDefined()
       expect(typeof response).toBe('object')
@@ -152,7 +153,7 @@ await describe('I04 - CertificateSigned', async () => {
     })
 
     await it('should accept single certificate (no chain)', async () => {
-      mockChargingStation.certificateManager = createMockCertificateManager({
+      station.certificateManager = createMockCertificateManager({
         storeCertificateResult: true,
       })
 
@@ -162,7 +163,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GenericStatus.Accepted)
@@ -178,7 +179,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GenericStatus.Rejected)
@@ -193,9 +194,9 @@ await describe('I04 - CertificateSigned', async () => {
       const mockCertManager = createMockCertificateManager({
         storeCertificateResult: true,
       })
-      mockChargingStation.certificateManager = mockCertManager
+      station.certificateManager = mockCertManager
       const mockCloseWSConnection = mock.fn()
-      mockChargingStation.closeWSConnection = mockCloseWSConnection
+      station.closeWSConnection = mockCloseWSConnection
 
       const request: OCPP20CertificateSignedRequest = {
         certificateChain: VALID_PEM_CERTIFICATE,
@@ -203,7 +204,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response.status).toBe(GenericStatus.Accepted)
       // Verify closeWSConnection was called to trigger reconnect
@@ -216,9 +217,9 @@ await describe('I04 - CertificateSigned', async () => {
       const mockCertManager = createMockCertificateManager({
         storeCertificateResult: true,
       })
-      mockChargingStation.certificateManager = mockCertManager
+      station.certificateManager = mockCertManager
       const mockCloseWSConnection = mock.fn()
-      mockChargingStation.closeWSConnection = mockCloseWSConnection
+      station.closeWSConnection = mockCloseWSConnection
 
       const request: OCPP20CertificateSignedRequest = {
         certificateChain: VALID_PEM_CERTIFICATE,
@@ -226,7 +227,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response.status).toBe(GenericStatus.Accepted)
       // Verify storeCertificate was called
@@ -239,7 +240,7 @@ await describe('I04 - CertificateSigned', async () => {
   await describe('Certificate Manager Missing', async () => {
     await it('should return Rejected status with InternalError when certificate manager is missing', async () => {
       // Create a separate mock charging station without certificateManager
-      const stationWithoutCertManager = createChargingStation({
+      const { station: stationWithoutCertManager } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
@@ -249,7 +250,7 @@ await describe('I04 - CertificateSigned', async () => {
           ocppVersion: OCPPVersion.VERSION_201,
         },
         websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
-      }) as TestableChargingStationWithCertificate
+      })
 
       // Ensure certificateManager is undefined (not present)
       delete stationWithoutCertManager.certificateManager
@@ -271,7 +272,7 @@ await describe('I04 - CertificateSigned', async () => {
 
   await describe('Storage Failure Handling', async () => {
     await it('should return Rejected status when storage fails', async () => {
-      mockChargingStation.certificateManager = createMockCertificateManager({
+      station.certificateManager = createMockCertificateManager({
         storeCertificateResult: false,
       })
 
@@ -281,7 +282,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GenericStatus.Rejected)
@@ -290,7 +291,7 @@ await describe('I04 - CertificateSigned', async () => {
     })
 
     await it('should return Rejected status when storage throws error', async () => {
-      mockChargingStation.certificateManager = createMockCertificateManager({
+      station.certificateManager = createMockCertificateManager({
         storeCertificateError: new Error('Storage full'),
       })
 
@@ -300,7 +301,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GenericStatus.Rejected)
@@ -311,7 +312,7 @@ await describe('I04 - CertificateSigned', async () => {
 
   await describe('Response Structure Validation', async () => {
     await it('should return response matching CertificateSignedResponse schema', async () => {
-      mockChargingStation.certificateManager = createMockCertificateManager({
+      station.certificateManager = createMockCertificateManager({
         storeCertificateResult: true,
       })
 
@@ -321,7 +322,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response).toBeDefined()
       expect(typeof response).toBe('object')
@@ -353,7 +354,7 @@ await describe('I04 - CertificateSigned', async () => {
       }
 
       const response: OCPP20CertificateSignedResponse =
-        await testableService.handleRequestCertificateSigned(mockChargingStation, request)
+        await testableService.handleRequestCertificateSigned(station, request)
 
       expect(response.status).toBe(GenericStatus.Rejected)
       expect(response.statusInfo).toBeDefined()
index a9e1a43edcbe5d3968c14379d21a0449f0c0ddfe..8dab1628e94e1316c01f2f5031411314ec95027b 100644 (file)
@@ -11,7 +11,7 @@ import { OCPP20IncomingRequestService } from '../../../../src/charging-station/o
 import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js'
 import { GenericStatus, OCPPVersion } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 await describe('C11 - Clear Authorization Data in Authorization Cache', async () => {
@@ -19,12 +19,12 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
     mock.restoreAll()
   })
 
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ChargingStation
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -35,13 +35,14 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = mockStation
     incomingRequestService = new OCPP20IncomingRequestService()
     testableService = createTestableIncomingRequestService(incomingRequestService)
   })
 
   // FR: C11.FR.01 - CS SHALL attempt to clear its Authorization Cache
   await it('should handle ClearCache request successfully', async () => {
-    const response = await testableService.handleRequestClearCache(mockChargingStation)
+    const response = await testableService.handleRequestClearCache(station)
 
     expect(response).toBeDefined()
     expect(typeof response).toBe('object')
@@ -52,7 +53,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
 
   // FR: C11.FR.02 - Return correct status based on cache clearing result
   await it('should return correct status based on cache clearing result', async () => {
-    const response = await testableService.handleRequestClearCache(mockChargingStation)
+    const response = await testableService.handleRequestClearCache(station)
 
     expect(response).toBeDefined()
     expect(response.status).toBeDefined()
@@ -82,7 +83,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       })
 
       try {
-        const response = await testableService.handleRequestClearCache(mockChargingStation)
+        const response = await testableService.handleRequestClearCache(station)
 
         expect(clearCacheCalled).toBe(true)
         expect(response.status).toBe(GenericStatus.Accepted)
@@ -95,22 +96,22 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
     await it('should NOT call idTagsCache.deleteIdTags() on ClearCache request', async () => {
       // Verify that IdTagsCache is not touched
       let deleteIdTagsCalled = false
-      const originalDeleteIdTags = mockChargingStation.idTagsCache.deleteIdTags.bind(
-        mockChargingStation.idTagsCache
+      const originalDeleteIdTags = station.idTagsCache.deleteIdTags.bind(
+        station.idTagsCache
       )
 
-      Object.assign(mockChargingStation.idTagsCache, {
+      Object.assign(station.idTagsCache, {
         deleteIdTags: () => {
           deleteIdTagsCalled = true
         },
       })
 
       try {
-        await testableService.handleRequestClearCache(mockChargingStation)
+        await testableService.handleRequestClearCache(station)
         expect(deleteIdTagsCalled).toBe(false)
       } finally {
         // Restore original method
-        Object.assign(mockChargingStation.idTagsCache, { deleteIdTags: originalDeleteIdTags })
+        Object.assign(station.idTagsCache, { deleteIdTags: originalDeleteIdTags })
       }
     })
   })
@@ -135,7 +136,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       })
 
       try {
-        const response = await testableService.handleRequestClearCache(mockChargingStation)
+        const response = await testableService.handleRequestClearCache(station)
 
         expect(response.status).toBe(GenericStatus.Rejected)
       } finally {
@@ -163,7 +164,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       })
 
       try {
-        const response = await testableService.handleRequestClearCache(mockChargingStation)
+        const response = await testableService.handleRequestClearCache(station)
 
         expect(response.status).toBe(GenericStatus.Accepted)
       } finally {
@@ -190,7 +191,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       })
 
       try {
-        const response = await testableService.handleRequestClearCache(mockChargingStation)
+        const response = await testableService.handleRequestClearCache(station)
 
         expect(response.status).toBe(GenericStatus.Rejected)
       } finally {
@@ -218,7 +219,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       })
 
       try {
-        await testableService.handleRequestClearCache(mockChargingStation)
+        await testableService.handleRequestClearCache(station)
 
         // clearCache should NOT be called when cache is disabled
         expect(clearCacheAttempted).toBe(false)
@@ -240,7 +241,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       })
 
       try {
-        const response = await testableService.handleRequestClearCache(mockChargingStation)
+        const response = await testableService.handleRequestClearCache(station)
 
         // Per C11.FR.05: SHALL return Rejected if CS does not support Authorization Cache
         expect(response.status).toBe(GenericStatus.Rejected)
index d6c6b6ca70f1ddb99f4f7cff5e838447cefea765..a8c64efdb8bb692b2ab7c44a2a2e58f33b34156d 100644 (file)
@@ -19,7 +19,7 @@ import {
   ReasonCodeEnumType,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createStationWithCertificateManager } from './OCPP20TestUtils.js'
 
@@ -59,13 +59,13 @@ await describe('I04 - DeleteCertificate', async () => {
     mock.restoreAll()
   })
 
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ChargingStation
   let stationWithCertManager: ChargingStationWithCertificateManager
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -76,9 +76,10 @@ await describe('I04 - DeleteCertificate', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = mockStation
 
     stationWithCertManager = createStationWithCertificateManager(
-      mockChargingStation,
+      station,
       createMockCertificateManager()
     )
 
@@ -97,7 +98,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response).toBeDefined()
       expect(typeof response).toBe('object')
@@ -120,7 +121,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(DeleteCertificateStatusEnumType.Accepted)
@@ -140,7 +141,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(DeleteCertificateStatusEnumType.Accepted)
@@ -159,7 +160,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(DeleteCertificateStatusEnumType.NotFound)
@@ -177,7 +178,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(DeleteCertificateStatusEnumType.Failed)
@@ -186,7 +187,7 @@ await describe('I04 - DeleteCertificate', async () => {
     })
 
     await it('should return Failed with InternalError when certificateManager is missing', async () => {
-      const stationWithoutCertManager = createChargingStation({
+      const { station: stationWithoutCertManager } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
@@ -228,7 +229,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response).toBeDefined()
       expect(typeof response).toBe('object')
@@ -264,7 +265,7 @@ await describe('I04 - DeleteCertificate', async () => {
       }
 
       const response: OCPP20DeleteCertificateResponse =
-        await testableService.handleRequestDeleteCertificate(mockChargingStation, request)
+        await testableService.handleRequestDeleteCertificate(station, request)
 
       expect(response.status).toBe(DeleteCertificateStatusEnumType.Failed)
       expect(response.statusInfo).toBeDefined()
index 96c2a544cfa5606b7f6b1f689c82f812aef0c31f..e5f672386ab1cf4ea2af5b5d24c75915b41936d4 100644 (file)
@@ -28,7 +28,7 @@ import {
 import { StandardParametersKey } from '../../../../src/types/ocpp/Configuration.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   TEST_CHARGE_POINT_MODEL,
   TEST_CHARGE_POINT_SERIAL_NUMBER,
@@ -38,12 +38,12 @@ import {
 } from '../../ChargingStationTestConstants.js'
 
 await describe('B07 - Get Base Report', async () => {
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ChargingStation
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -58,6 +58,7 @@ await describe('B07 - Get Base Report', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = mockStation
 
     incomingRequestService = new OCPP20IncomingRequestService()
 
@@ -77,7 +78,7 @@ await describe('B07 - Get Base Report', async () => {
       requestId: 1,
     }
 
-    const response = testableService.handleRequestGetBaseReport(mockChargingStation, request)
+    const response = testableService.handleRequestGetBaseReport(station, request)
 
     expect(response).toBeDefined()
     expect(response.status).toBe(GenericDeviceModelStatusEnumType.Accepted)
@@ -90,7 +91,7 @@ await describe('B07 - Get Base Report', async () => {
       requestId: 2,
     }
 
-    const response = testableService.handleRequestGetBaseReport(mockChargingStation, request)
+    const response = testableService.handleRequestGetBaseReport(station, request)
 
     expect(response).toBeDefined()
     expect(response.status).toBe(GenericDeviceModelStatusEnumType.Accepted)
@@ -98,7 +99,7 @@ await describe('B07 - Get Base Report', async () => {
 
   await it('should include registry variables with Actual attribute only for unsupported types', () => {
     const reportData = testableService.buildReportData(
-      mockChargingStation,
+      station,
       ReportBaseEnumType.FullInventory
     )
     const heartbeatEntry = reportData.find(
@@ -136,7 +137,7 @@ await describe('B07 - Get Base Report', async () => {
       requestId: 3,
     }
 
-    const response = testableService.handleRequestGetBaseReport(mockChargingStation, request)
+    const response = testableService.handleRequestGetBaseReport(station, request)
 
     expect(response).toBeDefined()
     expect(response.status).toBe(GenericDeviceModelStatusEnumType.Accepted)
@@ -149,7 +150,7 @@ await describe('B07 - Get Base Report', async () => {
       requestId: 4,
     }
 
-    const response = testableService.handleRequestGetBaseReport(mockChargingStation, request)
+    const response = testableService.handleRequestGetBaseReport(station, request)
 
     expect(response).toBeDefined()
     expect(response.status).toBe(GenericDeviceModelStatusEnumType.NotSupported)
@@ -164,7 +165,7 @@ await describe('B07 - Get Base Report', async () => {
       requestId: 5,
     }
 
-    const response = testableService.handleRequestGetBaseReport(mockChargingStation, request)
+    const response = testableService.handleRequestGetBaseReport(station, request)
 
     expect(response).toBeDefined()
     expect(response.status).toBe(GenericDeviceModelStatusEnumType.Accepted)
@@ -179,14 +180,14 @@ await describe('B07 - Get Base Report', async () => {
 
     // Test the buildReportData method indirectly by calling handleRequestGetBaseReport
     // and checking if it returns Accepted status (which means data was built successfully)
-    const response = testableService.handleRequestGetBaseReport(mockChargingStation, request)
+    const response = testableService.handleRequestGetBaseReport(station, request)
 
     expect(response).toBeDefined()
     expect(response.status).toBe(GenericDeviceModelStatusEnumType.Accepted)
 
     // We can also test the buildReportData method directly if needed
     const reportData = testableService.buildReportData(
-      mockChargingStation,
+      station,
       ReportBaseEnumType.ConfigurationInventory
     )
 
@@ -208,7 +209,7 @@ await describe('B07 - Get Base Report', async () => {
   // FR: B08.FR.07
   await it('should build correct report data for FullInventory with station info', () => {
     const reportData = testableService.buildReportData(
-      mockChargingStation,
+      station,
       ReportBaseEnumType.FullInventory
     )
 
@@ -240,7 +241,7 @@ await describe('B07 - Get Base Report', async () => {
   // FR: B08.FR.08
   await it('should build correct report data for SummaryInventory', () => {
     const reportData = testableService.buildReportData(
-      mockChargingStation,
+      station,
       ReportBaseEnumType.SummaryInventory
     )
 
@@ -264,10 +265,10 @@ await describe('B07 - Get Base Report', async () => {
     // Ensure ReportingValueSize is at a small value (default is Constants.OCPP_VALUE_ABSOLUTE_MAX_LENGTH). We will override configuration key if absent.
     const reportingSizeKey = StandardParametersKey.ReportingValueSize
     // Add or lower configuration key to 10 to force truncation
-    addConfigurationKey(mockChargingStation, reportingSizeKey, '10', undefined, {
+    addConfigurationKey(station, reportingSizeKey, '10', undefined, {
       overwrite: true,
     })
-    setConfigurationKeyValue(mockChargingStation, reportingSizeKey, '10')
+    setConfigurationKeyValue(station, reportingSizeKey, '10')
 
     // Choose TimeSource (SequenceList) and construct an artificially long ordered list value > 10 chars
     const variableManager = OCPP20VariableManager.getInstance()
@@ -275,7 +276,7 @@ await describe('B07 - Get Base Report', async () => {
     const longValue = 'Heartbeat,NTP,GPS,RealTimeClock,MobileNetwork,RadioTimeTransmitter'
     // Set Actual (SequenceList). Should accept full value internally.
     const setResult: OCPP20SetVariableResultType[] = variableManager.setVariables(
-      mockChargingStation,
+      station,
       [
         {
           attributeType: AttributeEnumType.Actual,
@@ -289,7 +290,7 @@ await describe('B07 - Get Base Report', async () => {
 
     // Build report; value should be truncated to length 10
     const reportData = testableService.buildReportData(
-      mockChargingStation,
+      station,
       ReportBaseEnumType.FullInventory
     )
     const timeSourceEntry = reportData.find(
@@ -312,8 +313,8 @@ await describe('B07 - Get Base Report', async () => {
 
   // FR: B08.FR.09
   await it('should handle GetBaseReport with EVSE structure', () => {
-    // The createChargingStation should create a station with EVSEs
-    const stationWithEvses = createChargingStation({
+    // Create a station with EVSEs
+    const { station: stationWithEvses } = createMockChargingStation({
       baseName: 'CS-EVSE-001',
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -345,7 +346,7 @@ await describe('B07 - Get Base Report', async () => {
   // FR: B08.FR.10
   await it('should validate unsupported reportBase correctly', () => {
     const reportData = testableService.buildReportData(
-      mockChargingStation,
+      station,
       'InvalidReportBase' as unknown as ReportBaseEnumType
     )
 
index a3f17ab446a0c2a3f786268900b699b890f254f0..74d2a6b67e5bf3ab7e4fcbf9894540776affb6a4 100644 (file)
@@ -21,7 +21,7 @@ import {
   OCPPVersion,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createStationWithCertificateManager } from './OCPP20TestUtils.js'
 
@@ -60,13 +60,13 @@ const createMockCertificateManager = (
 })
 
 await describe('I04 - GetInstalledCertificateIds', async () => {
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ChargingStation
   let stationWithCertManager: ChargingStationWithCertificateManager
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -77,9 +77,10 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = mockStation
 
     stationWithCertManager = createStationWithCertificateManager(
-      mockChargingStation,
+      station,
       createMockCertificateManager()
     )
 
@@ -106,7 +107,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       const request: OCPP20GetInstalledCertificateIdsRequest = {}
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GetInstalledCertificateStatusEnumType.Accepted)
@@ -132,7 +133,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       }
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GetInstalledCertificateStatusEnumType.Accepted)
@@ -161,7 +162,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       }
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GetInstalledCertificateStatusEnumType.Accepted)
@@ -178,7 +179,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       const request: OCPP20GetInstalledCertificateIdsRequest = {}
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response).toBeDefined()
       // Per OCPP 2.0.1 spec: NotFound is returned when no certificates match the request
@@ -197,7 +198,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       }
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response).toBeDefined()
       expect(response.status).toBe(GetInstalledCertificateStatusEnumType.NotFound)
@@ -213,7 +214,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       const request: OCPP20GetInstalledCertificateIdsRequest = {}
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response).toBeDefined()
       expect(typeof response).toBe('object')
@@ -237,7 +238,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       const request: OCPP20GetInstalledCertificateIdsRequest = {}
 
       const response: OCPP20GetInstalledCertificateIdsResponse =
-        await testableService.handleRequestGetInstalledCertificateIds(mockChargingStation, request)
+        await testableService.handleRequestGetInstalledCertificateIds(station, request)
 
       expect(response.status).toBe(GetInstalledCertificateStatusEnumType.Accepted)
       expect(response.certificateHashDataChain).toBeDefined()
index 12fd1116f2e57a01a8cc822841ac3a670fd2f517..b3164f1117daa48609d08261adafda97d1002eab 100644 (file)
@@ -22,11 +22,11 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
 import {
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_CONNECTOR_ID_VALID_INSTANCE,
-} from '../../ChargingStationTestConstants.js'
+  } from '../../ChargingStationTestConstants.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   resetLimits,
   resetReportingValueSize,
@@ -36,11 +36,11 @@ import {
 } from './OCPP20TestUtils.js'
 
 await describe('B06 - Get Variables', async () => {
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ReturnType<typeof createMockChargingStation>
   let incomingRequestService: OCPP20IncomingRequestService
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: newStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -51,6 +51,7 @@ await describe('B06 - Get Variables', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = newStation
     incomingRequestService = new OCPP20IncomingRequestService()
   })
 
@@ -76,7 +77,7 @@ await describe('B06 - Get Variables', async () => {
       ],
     }
 
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
 
     expect(response).toBeDefined()
     expect(response.getVariableResult).toBeDefined()
@@ -119,7 +120,7 @@ await describe('B06 - Get Variables', async () => {
       ],
     }
 
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
 
     expect(response).toBeDefined()
     expect(response.getVariableResult).toBeDefined()
@@ -159,7 +160,7 @@ await describe('B06 - Get Variables', async () => {
       ],
     }
 
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
 
     expect(response).toBeDefined()
     expect(response.getVariableResult).toBeDefined()
@@ -172,8 +173,8 @@ await describe('B06 - Get Variables', async () => {
 
   // FR: B06.FR.04
   await it('should reject AuthorizeRemoteStart under Connector component', () => {
-    resetLimits(mockChargingStation)
-    resetReportingValueSize(mockChargingStation)
+    resetLimits(station)
+    resetReportingValueSize(station)
     const request: OCPP20GetVariablesRequest = {
       getVariableData: [
         {
@@ -185,7 +186,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.UnknownComponent)
@@ -202,7 +203,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
@@ -210,7 +211,7 @@ await describe('B06 - Get Variables', async () => {
 
   await it('should truncate variable value based on ReportingValueSize', () => {
     // Set size below actual value length to force truncation
-    setReportingValueSize(mockChargingStation, 2)
+    setReportingValueSize(station, 2)
     const request: OCPP20GetVariablesRequest = {
       getVariableData: [
         {
@@ -219,11 +220,11 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
     expect(result.attributeValue?.length).toBe(2)
-    resetReportingValueSize(mockChargingStation)
+    resetReportingValueSize(station)
   })
 
   await it('should allow ReportingValueSize retrieval from DeviceDataCtrlr', () => {
@@ -235,14 +236,14 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
     expect(result.attributeValue).toBeDefined()
   })
 
   await it('should enforce ItemsPerMessage limit', () => {
-    setStrictLimits(mockChargingStation, 1, 10000)
+    setStrictLimits(station, 1, 10000)
     const request: OCPP20GetVariablesRequest = {
       getVariableData: [
         {
@@ -255,17 +256,17 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult.length).toBe(2)
     for (const r of response.getVariableResult) {
       expect(r.attributeStatus).toBe(GetVariableStatusEnumType.Rejected)
       expect(r.attributeStatusInfo?.reasonCode).toBeDefined()
     }
-    resetLimits(mockChargingStation)
+    resetLimits(station)
   })
 
   await it('should enforce BytesPerMessage limit (pre-calculation)', () => {
-    setStrictLimits(mockChargingStation, 100, 10)
+    setStrictLimits(station, 100, 10)
     const request: OCPP20GetVariablesRequest = {
       getVariableData: [
         {
@@ -278,13 +279,13 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult.length).toBe(2)
     response.getVariableResult.forEach(r => {
       expect(r.attributeStatus).toBe(GetVariableStatusEnumType.Rejected)
       expect(r.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.TooLargeElement)
     })
-    resetLimits(mockChargingStation)
+    resetLimits(station)
   })
 
   await it('should enforce BytesPerMessage limit (post-calculation)', () => {
@@ -318,8 +319,8 @@ await describe('B06 - Get Variables', async () => {
     }
     const preEstimate = Buffer.byteLength(JSON.stringify(request.getVariableData), 'utf8')
     const limit = preEstimate + 5 // allow pre-check pass, fail post-check
-    setStrictLimits(mockChargingStation, 100, limit)
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    setStrictLimits(station, 100, limit)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     const actualSize = Buffer.byteLength(JSON.stringify(response.getVariableResult), 'utf8')
     expect(actualSize).toBeGreaterThan(limit)
     expect(response.getVariableResult).toHaveLength(request.getVariableData.length)
@@ -327,7 +328,7 @@ await describe('B06 - Get Variables', async () => {
       expect(r.attributeStatus).toBe(GetVariableStatusEnumType.Rejected)
       expect(r.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.TooLargeElement)
     })
-    resetLimits(mockChargingStation)
+    resetLimits(station)
   })
 
   // Added tests for relocated components
@@ -341,7 +342,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
@@ -360,7 +361,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
@@ -380,7 +381,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
@@ -406,7 +407,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(3)
     const fileTransfer = response.getVariableResult[0]
     expect(fileTransfer.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
@@ -436,7 +437,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(3)
     const txStarted = response.getVariableResult[0]
     expect(txStarted.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
@@ -466,7 +467,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
@@ -485,7 +486,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.UnknownVariable)
@@ -503,7 +504,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Rejected)
@@ -525,7 +526,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(2)
     const minSet = response.getVariableResult[0]
     const maxSet = response.getVariableResult[1]
@@ -547,7 +548,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
@@ -563,7 +564,7 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     expect(response.getVariableResult).toHaveLength(1)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
@@ -571,8 +572,8 @@ await describe('B06 - Get Variables', async () => {
 
   await it('should apply ValueSize then ReportingValueSize sequential truncation', () => {
     // First apply a smaller ValueSize (5) then a smaller ReportingValueSize (3)
-    setValueSize(mockChargingStation, 5)
-    setReportingValueSize(mockChargingStation, 3)
+    setValueSize(station, 5)
+    setReportingValueSize(station, 3)
     const request: OCPP20GetVariablesRequest = {
       getVariableData: [
         {
@@ -581,11 +582,11 @@ await describe('B06 - Get Variables', async () => {
         },
       ],
     }
-    const response = incomingRequestService.handleRequestGetVariables(mockChargingStation, request)
+    const response = incomingRequestService.handleRequestGetVariables(station, request)
     const result = response.getVariableResult[0]
     expect(result.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
     expect(result.attributeValue).toBeDefined()
     expect(result.attributeValue?.length).toBeLessThanOrEqual(3)
-    resetReportingValueSize(mockChargingStation)
+    resetReportingValueSize(station)
   })
 })
index f57460a0157e7602a4d99ba9c86ee26d86d03c53..36595afa0573293ba1df478c52b1a19be30ebf99 100644 (file)
@@ -6,6 +6,7 @@
 import { expect } from '@std/expect'
 import { afterEach, beforeEach, describe, it, mock } from 'node:test'
 
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type { ChargingStationWithCertificateManager } from '../../../../src/charging-station/ocpp/2.0/OCPP20CertificateManager.js'
 
 import { createTestableIncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/__testable__/index.js'
@@ -18,7 +19,7 @@ import {
   OCPPVersion,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createStationWithCertificateManager } from './OCPP20TestUtils.js'
 
@@ -73,13 +74,14 @@ await describe('I03 - InstallCertificate', async () => {
     mock.restoreAll()
   })
 
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ChargingStation
+  let mockChargingStation: ChargingStation
   let stationWithCertManager: ChargingStationWithCertificateManager
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: initialStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -90,6 +92,8 @@ await describe('I03 - InstallCertificate', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = initialStation
+    mockChargingStation = initialStation
 
     // Use factory function to create station with certificate manager
     stationWithCertManager = createStationWithCertificateManager(
index 6fa4185a774a9d41bfed2f1b6f246e47a8365b60..355da7db35d1e3533ad219c17a439ca5a96838b0 100644 (file)
@@ -5,6 +5,7 @@
 import { expect } from '@std/expect'
 import { afterEach, beforeEach, describe, it } from 'node:test'
 
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type { OCPP20RequestStartTransactionRequest } from '../../../../src/types/index.js'
 import type {
   OCPP20ChargingProfileType,
@@ -22,7 +23,7 @@ import {
 } from '../../../../src/types/ocpp/2.0/Transaction.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createMockAuthService } from '../auth/helpers/MockFactories.js'
 import {
@@ -32,11 +33,11 @@ import {
 } from './OCPP20TestUtils.js'
 
 await describe('F01 & F02 - Remote Start Transaction', async () => {
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let mockChargingStation: ChargingStation
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -50,6 +51,7 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    mockChargingStation = station
     incomingRequestService = new OCPP20IncomingRequestService()
     testableService = createTestableIncomingRequestService(incomingRequestService)
     const stationId = mockChargingStation.stationInfo?.chargingStationId ?? 'unknown'
@@ -88,7 +90,7 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
 
   // FR: F01.FR.17, F02.FR.05 - Verify remoteStartId and idToken are stored for later TransactionEvent
   await it('should store remoteStartId and idToken in connector status for TransactionEvent', async () => {
-    const spyChargingStation = createChargingStation({
+    const { station: spyChargingStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
index 0a4704639363035a5668d5ccf1fca9ee6acb2ed5..10a0aa6a78db43636f191c501e9ecf4a053c5c96 100644 (file)
@@ -6,6 +6,7 @@
 import { expect } from '@std/expect'
 import { afterEach, beforeEach, describe, it } from 'node:test'
 
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type {
   OCPP20RequestStartTransactionRequest,
   OCPP20RequestStopTransactionRequest,
@@ -29,7 +30,7 @@ import {
 } from '../../../../src/types/ocpp/2.0/Transaction.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createMockAuthService } from '../auth/helpers/MockFactories.js'
 import {
@@ -40,13 +41,13 @@ import {
 
 await describe('F03 - Remote Stop Transaction', async () => {
   let sentTransactionEvents: OCPP20TransactionEventRequest[] = []
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let mockChargingStation: ChargingStation
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
     sentTransactionEvents = []
-    mockChargingStation = createChargingStation({
+    const { station } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -70,6 +71,7 @@ await describe('F03 - Remote Stop Transaction', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    mockChargingStation = station
     incomingRequestService = new OCPP20IncomingRequestService()
     testableService = createTestableIncomingRequestService(incomingRequestService)
     const stationId = mockChargingStation.stationInfo?.chargingStationId ?? 'unknown'
index ecfd98d6f92229eb29dbecde4c5c0f352e401a91..ac87da96e01912d979c7882589be68038af5f8e6 100644 (file)
@@ -24,12 +24,16 @@ import {
   ResetStatusEnumType,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 await describe('B11 & B12 - Reset', async () => {
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let mockChargingStation: ChargingStation
+  let mockStation: ChargingStation & {
+    getNumberOfRunningTransactions: () => number
+    reset: () => Promise<void>
+  }
   let mockStation: ReturnType<typeof createChargingStation> & {
     getNumberOfRunningTransactions: () => number
     reset: () => Promise<void>
@@ -40,7 +44,7 @@ await describe('B11 & B12 - Reset', async () => {
   beforeEach(() => {
     mock.timers.enable({ apis: ['setInterval', 'setTimeout', 'setImmediate'] })
 
-    mockChargingStation = createChargingStation({
+    const { station } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -52,6 +56,7 @@ await describe('B11 & B12 - Reset', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    mockChargingStation = station
 
     // Add missing method to mock using interface extension pattern
     interface MockChargingStation extends ChargingStation {
index d47ce5c417011f671adb207f7549a1ec70996390..cec05d4dac6829173adaed08be5fe2ff00186b8f 100644 (file)
@@ -7,6 +7,7 @@ import { expect } from '@std/expect'
 import { millisecondsToSeconds } from 'date-fns'
 import { afterEach, beforeEach, describe, it } from 'node:test'
 
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import { createTestableIncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/__testable__/index.js'
 import { OCPP20IncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.js'
 import { OCPP20VariableManager } from '../../../../src/charging-station/ocpp/2.0/OCPP20VariableManager.js'
@@ -26,7 +27,7 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   TEST_CHARGING_STATION_BASE_NAME,
   TEST_CONNECTOR_ID_VALID_INSTANCE,
@@ -41,12 +42,12 @@ import {
 } from './OCPP20TestUtils.js'
 
 await describe('B05 - Set Variables', async () => {
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let mockChargingStation: ChargingStation
   let incomingRequestService: OCPP20IncomingRequestService
   let testableService: ReturnType<typeof createTestableIncomingRequestService>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -57,6 +58,7 @@ await describe('B05 - Set Variables', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    mockChargingStation = station
     incomingRequestService = new OCPP20IncomingRequestService()
     testableService = createTestableIncomingRequestService(incomingRequestService)
   })
index da9835a10c85b969296b8ba614a4524dcf2fd893..727559744240123e94703bdcf9dddd989e921534 100644 (file)
@@ -13,9 +13,10 @@ import {
   OCPP20RequestCommand,
   OCPPVersion,
 } from '../../../../src/types/index.js'
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import { type ChargingStationType } from '../../../../src/types/ocpp/2.0/Common.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation, type TestChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../../ChargingStationTestUtils.js'
 import {
   TEST_CHARGE_POINT_MODEL,
   TEST_CHARGE_POINT_SERIAL_NUMBER,
@@ -32,13 +33,13 @@ await describe('B01 - Cold Boot Charging Station', async () => {
   let mockResponseService: OCPP20ResponseService
   let requestService: OCPP20RequestService
   let testableRequestService: TestableOCPP20RequestService
-  let mockChargingStation: TestChargingStation
+  let station: ChargingStation
 
   beforeEach(() => {
     mockResponseService = new OCPP20ResponseService()
     requestService = new OCPP20RequestService(mockResponseService)
     testableRequestService = createTestableOCPP20RequestService(requestService)
-    mockChargingStation = createChargingStation({
+    const { station: createdStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -53,6 +54,7 @@ await describe('B01 - Cold Boot Charging Station', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = createdStation
   })
 
   afterEach(() => {
@@ -74,7 +76,7 @@ await describe('B01 - Cold Boot Charging Station', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.BOOT_NOTIFICATION,
       requestParams
     ) as OCPP20BootNotificationRequest
@@ -103,7 +105,7 @@ await describe('B01 - Cold Boot Charging Station', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.BOOT_NOTIFICATION,
       requestParams
     ) as OCPP20BootNotificationRequest
@@ -131,7 +133,7 @@ await describe('B01 - Cold Boot Charging Station', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.BOOT_NOTIFICATION,
       requestParams
     ) as OCPP20BootNotificationRequest
@@ -171,7 +173,7 @@ await describe('B01 - Cold Boot Charging Station', async () => {
       }
 
       const payload = testableRequestService.buildRequestPayload(
-        mockChargingStation,
+      station,
         OCPP20RequestCommand.BOOT_NOTIFICATION,
         requestParams
       ) as OCPP20BootNotificationRequest
@@ -200,7 +202,7 @@ await describe('B01 - Cold Boot Charging Station', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.BOOT_NOTIFICATION,
       requestParams
     ) as OCPP20BootNotificationRequest
index 8d9c3b76bd8f85664b6b88990efff0bb478fd860..aaebbd32be1216d0fbc4c15ba2a36cb462406ea1 100644 (file)
@@ -13,7 +13,8 @@ import {
   OCPPVersion,
 } from '../../../../src/types/index.js'
 import { Constants, has } from '../../../../src/utils/index.js'
-import { createChargingStation, type TestChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../../ChargingStationTestUtils.js'
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import {
   TEST_CHARGE_POINT_MODEL,
   TEST_CHARGE_POINT_SERIAL_NUMBER,
@@ -30,13 +31,13 @@ await describe('G02 - Heartbeat', async () => {
   let mockResponseService: OCPP20ResponseService
   let requestService: OCPP20RequestService
   let testableRequestService: TestableOCPP20RequestService
-  let mockChargingStation: TestChargingStation
+  let station: ChargingStation
 
   beforeEach(() => {
     mockResponseService = new OCPP20ResponseService()
     requestService = new OCPP20RequestService(mockResponseService)
     testableRequestService = createTestableOCPP20RequestService(requestService)
-    mockChargingStation = createChargingStation({
+    const { station: createdStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -51,6 +52,7 @@ await describe('G02 - Heartbeat', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = createdStation
   })
 
   afterEach(() => {
@@ -62,7 +64,7 @@ await describe('G02 - Heartbeat', async () => {
     const requestParams: OCPP20HeartbeatRequest = {}
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT,
       requestParams
     )
@@ -76,7 +78,7 @@ await describe('G02 - Heartbeat', async () => {
   await it('should build HeartBeat request payload correctly without parameters', () => {
     // Test without passing any request parameters
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT
     )
 
@@ -90,7 +92,7 @@ await describe('G02 - Heartbeat', async () => {
     const requestParams: OCPP20HeartbeatRequest = {}
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT,
       requestParams
     )
@@ -109,19 +111,19 @@ await describe('G02 - Heartbeat', async () => {
 
     // Call buildRequestPayload multiple times to ensure consistency
     const payload1 = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT,
       requestParams
     )
 
     const payload2 = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT,
       requestParams
     )
 
     const payload3 = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT
     )
 
@@ -171,7 +173,7 @@ await describe('G02 - Heartbeat', async () => {
     const requestParams: OCPP20HeartbeatRequest = {}
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.HEARTBEAT,
       requestParams
     )
index 3836e607832a3bcd8063f240c1ebc842895e8115..589d33930a13717e638e92d0cd7ddc74433588cb 100644 (file)
@@ -23,8 +23,8 @@ import {
   ReasonCodeEnumType,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation, type TestChargingStation } from '../../../ChargingStationFactory.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 
 // Sample Base64 EXI request (mock - represents CertificateInstallationReq)
 const MOCK_EXI_REQUEST = 'SGVsbG8gV29ybGQgRVhJIFJlcXVlc3Q='
@@ -42,10 +42,10 @@ const createMockOCSPRequestData = (): OCSPRequestDataType => ({
 })
 
 await describe('M02 - Get15118EVCertificate Request', async () => {
-  let mockChargingStation: TestChargingStation
+  let station: ReturnType<typeof createMockChargingStation>
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: newStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -56,6 +56,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = newStation
   })
 
   afterEach(() => {
@@ -73,7 +74,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
         })
 
       await service.requestGet15118EVCertificate(
-        mockChargingStation,
+        station,
         MOCK_ISO15118_SCHEMA_VERSION,
         CertificateActionEnumType.Install,
         MOCK_EXI_REQUEST
@@ -99,7 +100,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
         })
 
       await service.requestGet15118EVCertificate(
-        mockChargingStation,
+        station,
         MOCK_ISO15118_SCHEMA_VERSION,
         CertificateActionEnumType.Update,
         MOCK_EXI_REQUEST
@@ -122,7 +123,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
       })
 
       const response = await service.requestGet15118EVCertificate(
-        mockChargingStation,
+        station,
         MOCK_ISO15118_SCHEMA_VERSION,
         CertificateActionEnumType.Install,
         MOCK_EXI_REQUEST
@@ -145,7 +146,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
       })
 
       const response = await service.requestGet15118EVCertificate(
-        mockChargingStation,
+        station,
         MOCK_ISO15118_SCHEMA_VERSION,
         CertificateActionEnumType.Install,
         MOCK_EXI_REQUEST
@@ -168,7 +169,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
         })
 
       await service.requestGet15118EVCertificate(
-        mockChargingStation,
+        station,
         MOCK_ISO15118_SCHEMA_VERSION,
         CertificateActionEnumType.Install,
         MOCK_EXI_REQUEST
@@ -194,7 +195,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
         })
 
       await service.requestGet15118EVCertificate(
-        mockChargingStation,
+        station,
         MOCK_ISO15118_SCHEMA_VERSION,
         CertificateActionEnumType.Install,
         complexBase64EXI
@@ -209,10 +210,10 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
 })
 
 await describe('M03 - GetCertificateStatus Request', async () => {
-  let mockChargingStation: TestChargingStation
+  let station: TestChargingStation
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    station = createChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -241,7 +242,7 @@ await describe('M03 - GetCertificateStatus Request', async () => {
 
       const ocspRequestData = createMockOCSPRequestData()
 
-      await service.requestGetCertificateStatus(mockChargingStation, ocspRequestData)
+      await service.requestGetCertificateStatus(station, ocspRequestData)
 
       expect(sendMessageMock.mock.calls.length).toBe(1)
 
@@ -266,7 +267,7 @@ await describe('M03 - GetCertificateStatus Request', async () => {
       })
 
       const response = await service.requestGetCertificateStatus(
-        mockChargingStation,
+        station,
         createMockOCSPRequestData()
       )
 
@@ -286,7 +287,7 @@ await describe('M03 - GetCertificateStatus Request', async () => {
       })
 
       const response = await service.requestGetCertificateStatus(
-        mockChargingStation,
+        station,
         createMockOCSPRequestData()
       )
 
@@ -311,7 +312,7 @@ await describe('M03 - GetCertificateStatus Request', async () => {
         })
 
       const response = await service.requestGetCertificateStatus(
-        mockChargingStation,
+        station,
         createMockOCSPRequestData()
       )
 
@@ -326,10 +327,10 @@ await describe('M03 - GetCertificateStatus Request', async () => {
 })
 
 await describe('Request Command Names', async () => {
-  let mockChargingStation: TestChargingStation
+  let station: TestChargingStation
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    station = createChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
@@ -356,7 +357,7 @@ await describe('Request Command Names', async () => {
       })
 
     await service.requestGet15118EVCertificate(
-      mockChargingStation,
+      station,
       MOCK_ISO15118_SCHEMA_VERSION,
       CertificateActionEnumType.Install,
       MOCK_EXI_REQUEST
@@ -375,7 +376,7 @@ await describe('Request Command Names', async () => {
         },
       })
 
-    await service.requestGetCertificateStatus(mockChargingStation, createMockOCSPRequestData())
+    await service.requestGetCertificateStatus(station, createMockOCSPRequestData())
 
     const commandName = sendMessageMock.mock.calls[0].arguments[3]
     expect(commandName).toBe(OCPP20RequestCommand.GET_CERTIFICATE_STATUS)
index 9bcd69035eeac0c34b7bf266a1831ccc35fdd022..d0692193475cc5bea7c4f06970974f8c47d2615f 100644 (file)
@@ -22,7 +22,8 @@ import {
   type ReportDataType,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation, type TestChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../../ChargingStationTestUtils.js'
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import {
   TEST_CHARGE_POINT_MODEL,
   TEST_CHARGE_POINT_SERIAL_NUMBER,
@@ -33,12 +34,12 @@ import {
 
 await describe('B07/B08 - NotifyReport', async () => {
   let testableService: TestableOCPP20RequestService
-  let mockChargingStation: TestChargingStation
+  let station: ChargingStation
 
   beforeEach(() => {
     const { service } = createTestableRequestService()
     testableService = service
-    mockChargingStation = createChargingStation({
+    const { station: createdStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -53,6 +54,7 @@ await describe('B07/B08 - NotifyReport', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = createdStation
   })
 
   afterEach(() => {
@@ -69,7 +71,7 @@ await describe('B07/B08 - NotifyReport', async () => {
 
     // Access the private buildRequestPayload method via type assertion
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -113,7 +115,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -195,7 +197,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -241,7 +243,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -266,7 +268,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -315,7 +317,7 @@ await describe('B07/B08 - NotifyReport', async () => {
       }
 
       const payload = testableService.buildRequestPayload(
-        mockChargingStation,
+        station,
         OCPP20RequestCommand.NOTIFY_REPORT,
         requestParams
       ) as OCPP20NotifyReportRequest
@@ -368,7 +370,7 @@ await describe('B07/B08 - NotifyReport', async () => {
       }
 
       const payload = testableService.buildRequestPayload(
-        mockChargingStation,
+        station,
         OCPP20RequestCommand.NOTIFY_REPORT,
         requestParams
       ) as OCPP20NotifyReportRequest
@@ -410,7 +412,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -475,7 +477,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
@@ -513,7 +515,7 @@ await describe('B07/B08 - NotifyReport', async () => {
     }
 
     const payload = testableService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.NOTIFY_REPORT,
       requestParams
     ) as OCPP20NotifyReportRequest
index d3e718c8924e2e5a7d85996cfd1997a6e34c22f6..b896f1af607c676561243698da16b3b3aa0adc94 100644 (file)
@@ -16,16 +16,17 @@ import {
   OCPPVersion,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation, type TestChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../../ChargingStationTestUtils.js'
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 
 const MOCK_ORGANIZATION_NAME = 'Test Organization Inc.'
 
 await describe('I02 - SignCertificate Request', async () => {
-  let mockChargingStation: TestChargingStation
+  let station: ChargingStation
 
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: createdStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -36,8 +37,9 @@ await describe('I02 - SignCertificate Request', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = createdStation
     // Set up configuration with OrganizationName
-    mockChargingStation.ocppConfiguration = {
+    station.ocppConfiguration = {
       configurationKey: [{ key: 'SecurityCtrlr.OrganizationName', value: MOCK_ORGANIZATION_NAME }],
     }
   })
@@ -56,7 +58,7 @@ await describe('I02 - SignCertificate Request', async () => {
         })
 
       const response = await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
@@ -80,7 +82,7 @@ await describe('I02 - SignCertificate Request', async () => {
         })
 
       await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
@@ -108,7 +110,7 @@ await describe('I02 - SignCertificate Request', async () => {
         })
 
       await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
@@ -130,7 +132,7 @@ await describe('I02 - SignCertificate Request', async () => {
         })
 
       await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.V2GCertificate
       )
 
@@ -149,7 +151,7 @@ await describe('I02 - SignCertificate Request', async () => {
       })
 
       const response = await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
@@ -168,7 +170,7 @@ await describe('I02 - SignCertificate Request', async () => {
       })
 
       const response = await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
@@ -188,7 +190,7 @@ await describe('I02 - SignCertificate Request', async () => {
           },
         })
 
-      await service.requestSignCertificate(mockChargingStation)
+      await service.requestSignCertificate(station)
 
       const sentPayload = sendMessageMock.mock.calls[0].arguments[2] as OCPP20SignCertificateRequest
 
@@ -208,7 +210,7 @@ await describe('I02 - SignCertificate Request', async () => {
         })
 
       await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
@@ -233,7 +235,7 @@ await describe('I02 - SignCertificate Request', async () => {
         })
 
       await service.requestSignCertificate(
-        mockChargingStation,
+        station,
         CertificateSigningUseEnumType.ChargingStationCertificate
       )
 
index c4a6bdb203553a3c576fa7238568f67bc6323645..8b8878ff204d24af3f3b4efee6167badffed4c02 100644 (file)
@@ -14,7 +14,8 @@ import {
   OCPPVersion,
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
-import { createChargingStation, type TestChargingStation } from '../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../../ChargingStationTestUtils.js'
+import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import {
   TEST_FIRMWARE_VERSION,
   TEST_STATUS_CHARGE_POINT_MODEL,
@@ -31,13 +32,13 @@ await describe('G01 - Status Notification', async () => {
   let mockResponseService: OCPP20ResponseService
   let requestService: OCPP20RequestService
   let testableRequestService: TestableOCPP20RequestService
-  let mockChargingStation: TestChargingStation
+  let station: ChargingStation
 
   beforeEach(() => {
     mockResponseService = new OCPP20ResponseService()
     requestService = new OCPP20RequestService(mockResponseService)
     testableRequestService = createTestableOCPP20RequestService(requestService)
-    mockChargingStation = createChargingStation({
+    const { station: createdStation } = createMockChargingStation({
       baseName: TEST_STATUS_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -52,6 +53,7 @@ await describe('G01 - Status Notification', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = createdStation
   })
 
   afterEach(() => {
@@ -70,7 +72,7 @@ await describe('G01 - Status Notification', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.STATUS_NOTIFICATION,
       requestParams
     ) as OCPP20StatusNotificationRequest
@@ -94,7 +96,7 @@ await describe('G01 - Status Notification', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.STATUS_NOTIFICATION,
       requestParams
     ) as OCPP20StatusNotificationRequest
@@ -118,7 +120,7 @@ await describe('G01 - Status Notification', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.STATUS_NOTIFICATION,
       requestParams
     ) as OCPP20StatusNotificationRequest
@@ -151,7 +153,7 @@ await describe('G01 - Status Notification', async () => {
       }
 
       const payload = testableRequestService.buildRequestPayload(
-        mockChargingStation,
+        station,
         OCPP20RequestCommand.STATUS_NOTIFICATION,
         requestParams
       ) as OCPP20StatusNotificationRequest
@@ -176,7 +178,7 @@ await describe('G01 - Status Notification', async () => {
     }
 
     const payload = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.STATUS_NOTIFICATION,
       requestParams
     ) as OCPP20StatusNotificationRequest
@@ -215,7 +217,7 @@ await describe('G01 - Status Notification', async () => {
     }
 
     const payloadConnector0 = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.STATUS_NOTIFICATION,
       requestParamsConnector0
     ) as OCPP20StatusNotificationRequest
@@ -235,7 +237,7 @@ await describe('G01 - Status Notification', async () => {
     }
 
     const payloadEvse0 = testableRequestService.buildRequestPayload(
-      mockChargingStation,
+      station,
       OCPP20RequestCommand.STATUS_NOTIFICATION,
       requestParamsEvse0
     ) as OCPP20StatusNotificationRequest
@@ -265,7 +267,7 @@ await describe('G01 - Status Notification', async () => {
       }
 
       const payload = testableRequestService.buildRequestPayload(
-        mockChargingStation,
+        station,
         OCPP20RequestCommand.STATUS_NOTIFICATION,
         requestParams
       ) as OCPP20StatusNotificationRequest
index f38e1d4554c3d70867d9ea688aa1afa740132789..fa3fa3f67fafcccb71d33602a6208152054cb85c 100644 (file)
@@ -32,8 +32,8 @@ import {
 } from '../../../../src/types/ocpp/2.0/Transaction.js'
 import { Constants, generateUUID } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   type CapturedOCPPRequest,
   createMockOCPP20TransactionTestStation,
@@ -300,7 +300,7 @@ await describe('E01-E04 - OCPP 2.0.1 TransactionEvent Implementation', async ()
 
     await it('should handle errors gracefully', async () => {
       // Create a mock charging station that throws an error
-      const errorMockChargingStation = createChargingStation({
+      const { station: errorMockChargingStation } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
@@ -867,7 +867,7 @@ await describe('E01-E04 - OCPP 2.0.1 TransactionEvent Implementation', async ()
 
       await it('should handle context-aware error scenarios gracefully', async () => {
         // Create error mock for this test
-        const errorMockChargingStation = createChargingStation({
+        const { station: errorMockChargingStation } = createMockChargingStation({
           baseName: TEST_CHARGING_STATION_BASE_NAME,
           connectorsCount: 1,
           evseConfiguration: { evsesCount: 1 },
@@ -2353,7 +2353,7 @@ await describe('E02 - OCPP 2.0.1 Offline TransactionEvent Queueing', async () =>
         return Promise.resolve({} as EmptyObject)
       })
 
-      const errorStation = createChargingStation({
+      const { station: errorStation } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
@@ -2433,7 +2433,7 @@ await describe('E02 - OCPP 2.0.1 Periodic TransactionEvent at TxUpdatedInterval'
 
   await describe('startTxUpdatedInterval', async () => {
     await it('should not start timer for non-OCPP 2.0 stations', () => {
-      const ocpp16Station = createChargingStation({
+      const { station: ocpp16Station } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         stationInfo: {
@@ -2697,7 +2697,7 @@ await describe('E02 - OCPP 2.0.1 Periodic TransactionEvent at TxUpdatedInterval'
 
   await describe('Error handling', async () => {
     await it('should handle network errors gracefully during periodic event', async () => {
-      const errorMockChargingStation = createChargingStation({
+      const { station: errorMockChargingStation } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
index a846801c4d8dcdc89fe94de0f9ab57b2a6ba0acb..1d8eb1c4638b9fb1e55bf2b39c5e91db3c30c2ef 100644 (file)
@@ -32,8 +32,8 @@ import {
 } from '../../../../src/types/index.js'
 import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../../tests/helpers/TestLifecycleHelpers.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   resetReportingValueSize,
   resetValueSizeLimits,
@@ -64,11 +64,11 @@ function buildWsExampleUrl (targetLength: number, fillerChar = 'a'): string {
 
 await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
   // Type declaration for mock ChargingStation
-  let mockChargingStation: ReturnType<typeof createChargingStation>
+  let station: ReturnType<typeof createMockChargingStation>
 
   // Initialize mock ChargingStation before each test
   beforeEach(() => {
-    mockChargingStation = createChargingStation({
+    const { station: newStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
@@ -78,6 +78,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       },
       websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL,
     })
+    station = newStation
   })
 
   // Reset singleton state after each test to ensure test isolation
@@ -111,7 +112,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
 
       expect(Array.isArray(result)).toBe(true)
       expect(result).toHaveLength(2)
@@ -141,7 +142,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20RequiredVariableName.AuthorizeRemoteStart },
         },
       ]
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(result[0].attributeValue).toBe('true')
@@ -149,7 +150,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should accept setting and getting AuthorizeRemoteStart = true (AuthCtrlr)', () => {
-      const setRes = manager.setVariables(mockChargingStation, [
+      const setRes = manager.setVariables(station, [
         {
           attributeValue: 'true',
           component: { name: OCPP20ComponentName.AuthCtrlr },
@@ -157,7 +158,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(setRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
-      const getRes = manager.getVariables(mockChargingStation, [
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.AuthCtrlr },
           variable: { name: OCPP20RequiredVariableName.AuthorizeRemoteStart },
@@ -170,7 +171,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     await it('should reject invalid values for AuthorizeRemoteStart (AuthCtrlr)', () => {
       const invalidValues = ['', '1', 'TRUE', 'False', 'yes']
       for (const val of invalidValues) {
-        const res = manager.setVariables(mockChargingStation, [
+        const res = manager.setVariables(station, [
           {
             attributeValue: val,
             component: { name: OCPP20ComponentName.AuthCtrlr },
@@ -190,7 +191,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
 
       expect(Array.isArray(result)).toBe(true)
       expect(result).toHaveLength(1)
@@ -214,7 +215,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
 
       expect(Array.isArray(result)).toBe(true)
       expect(result).toHaveLength(1)
@@ -238,7 +239,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
       ]
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
       expect(result[0].variable.name).toBe(OCPP20OptionalVariableName.WebSocketPingInterval)
@@ -255,7 +256,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
 
       expect(Array.isArray(result)).toBe(true)
       expect(result).toHaveLength(1)
@@ -289,7 +290,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
 
       expect(Array.isArray(result)).toBe(true)
       expect(result).toHaveLength(3)
@@ -312,7 +313,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       // Third variable: MessageTimeout
       expect(result[2].attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(result[2].attributeType).toBe(AttributeEnumType.Actual)
-      expect(result[2].attributeValue).toBe(mockChargingStation.getConnectionTimeout().toString())
+      expect(result[2].attributeValue).toBe(station.getConnectionTimeout().toString())
       expect(result[2].component.name).toBe(OCPP20ComponentName.OCPPCommCtrlr)
       expect(result[2].component.instance).toBe('Default')
       expect(result[2].variable.name).toBe(OCPP20RequiredVariableName.MessageTimeout)
@@ -330,7 +331,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.getVariables(mockChargingStation, request)
+      const result = manager.getVariables(station, request)
 
       expect(Array.isArray(result)).toBe(true)
       expect(result).toHaveLength(1)
@@ -355,7 +356,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       const component: ComponentType = { name: OCPP20ComponentName.OCPPCommCtrlr }
 
       // Access private method through any casting for testing
-      const isValid = testable.isComponentValid(mockChargingStation, component)
+      const isValid = testable.isComponentValid(station, component)
       expect(isValid).toBe(true)
     })
 
@@ -364,14 +365,14 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     await it('should reject Connector component as unsupported even when connectors exist', () => {
       const component: ComponentType = { instance: '1', name: OCPP20ComponentName.Connector }
 
-      const isValid = testable.isComponentValid(mockChargingStation, component)
+      const isValid = testable.isComponentValid(station, component)
       expect(isValid).toBe(false)
     })
 
     await it('should reject invalid connector instance', () => {
       const component: ComponentType = { instance: '999', name: OCPP20ComponentName.Connector }
 
-      const isValid = testable.isComponentValid(mockChargingStation, component)
+      const isValid = testable.isComponentValid(station, component)
       expect(isValid).toBe(false)
     })
   })
@@ -427,7 +428,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
 
       expect(result).toHaveLength(2)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
@@ -447,7 +448,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
 
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.UnknownComponent)
@@ -463,7 +464,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
 
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.UnknownVariable)
@@ -480,7 +481,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
 
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.NotSupportedAttributeType)
@@ -497,7 +498,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ]
 
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
 
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.Rejected)
@@ -526,7 +527,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
         },
       ]
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(result[0].attributeStatusInfo).toBeUndefined()
     })
@@ -553,9 +554,9 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
         },
       ]
-      const zeroRes = manager.setVariables(mockChargingStation, zeroReq)[0]
-      const negRes = manager.setVariables(mockChargingStation, negReq)[0]
-      const nonIntRes = manager.setVariables(mockChargingStation, nonIntReq)[0]
+      const zeroRes = manager.setVariables(station, zeroReq)[0]
+      const negRes = manager.setVariables(station, negReq)[0]
+      const nonIntRes = manager.setVariables(station, nonIntReq)[0]
       expect(zeroRes.attributeStatus).toBe(SetVariableStatusEnumType.Rejected)
       expect(zeroRes.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.ValuePositiveOnly)
       expect(zeroRes.attributeStatusInfo?.additionalInfo).toContain('Positive integer > 0 required')
@@ -575,7 +576,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
         },
       ]
-      const res = manager.setVariables(mockChargingStation, req)[0]
+      const res = manager.setVariables(station, req)[0]
       expect(res.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(res.attributeStatusInfo).toBeUndefined()
     })
@@ -588,7 +589,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
         },
       ]
-      const res = manager.setVariables(mockChargingStation, req)[0]
+      const res = manager.setVariables(station, req)[0]
       expect(res.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(res.attributeStatusInfo).toBeUndefined()
     })
@@ -601,13 +602,13 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
         },
       ]
-      const res = manager.setVariables(mockChargingStation, req)[0]
+      const res = manager.setVariables(station, req)[0]
       expect(res.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(res.attributeStatusInfo).toBeUndefined()
     })
 
     await it('should allow ConnectionUrl retrieval after set', () => {
-      manager.setVariables(mockChargingStation, [
+      manager.setVariables(station, [
         {
           attributeValue: 'wss://example.com/ocpp',
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -621,21 +622,21 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
         },
       ]
-      const getResult = manager.getVariables(mockChargingStation, getData)[0]
+      const getResult = manager.getVariables(station, getData)[0]
       expect(getResult.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(getResult.attributeValue).toBe('wss://example.com/ocpp')
       expect(getResult.attributeStatusInfo).toBeUndefined()
     })
 
     await it('should revert non-persistent TxUpdatedInterval after simulated restart', () => {
-      manager.setVariables(mockChargingStation, [
+      manager.setVariables(station, [
         {
           attributeValue: '99',
           component: { name: OCPP20ComponentName.SampledDataCtrlr },
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
         },
       ])
-      const beforeReset = manager.getVariables(mockChargingStation, [
+      const beforeReset = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SampledDataCtrlr },
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
@@ -643,7 +644,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(beforeReset.attributeValue).toBe('99')
       manager.resetRuntimeOverrides()
-      const afterReset = manager.getVariables(mockChargingStation, [
+      const afterReset = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SampledDataCtrlr },
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
@@ -653,7 +654,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should keep persistent ConnectionUrl after simulated restart', () => {
-      manager.setVariables(mockChargingStation, [
+      manager.setVariables(station, [
         {
           attributeValue: 'https://central.example.com/ocpp',
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -661,7 +662,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])
       manager.resetRuntimeOverrides()
-      const getResult = manager.getVariables(mockChargingStation, [
+      const getResult = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
@@ -681,7 +682,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
       ]
-      const result = manager.setVariables(mockChargingStation, request)
+      const result = manager.setVariables(station, request)
       expect(result).toHaveLength(1)
       expect(result[0].attributeStatus).toBe(SetVariableStatusEnumType.NotSupportedAttributeType)
       expect(result[0].attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.UnsupportedParam)
@@ -697,27 +698,27 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
         },
       ]
-      const res = manager.setVariables(mockChargingStation, req)[0]
+      const res = manager.setVariables(station, req)[0]
       expect(res.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(res.attributeStatusInfo).toBeUndefined()
     })
 
     await it('should reject HeartbeatInterval zero, negative, non-integer', () => {
-      const zeroRes = manager.setVariables(mockChargingStation, [
+      const zeroRes = manager.setVariables(station, [
         {
           attributeValue: '0',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
         },
       ])[0]
-      const negRes = manager.setVariables(mockChargingStation, [
+      const negRes = manager.setVariables(station, [
         {
           attributeValue: '-1',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
         },
       ])[0]
-      const nonIntRes = manager.setVariables(mockChargingStation, [
+      const nonIntRes = manager.setVariables(station, [
         {
           attributeValue: '10.5',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -733,14 +734,14 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should accept WebSocketPingInterval zero (disable) and positive', () => {
-      const zeroRes = manager.setVariables(mockChargingStation, [
+      const zeroRes = manager.setVariables(station, [
         {
           attributeValue: '0',
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
       ])[0]
-      const posRes = manager.setVariables(mockChargingStation, [
+      const posRes = manager.setVariables(station, [
         {
           attributeValue: (Constants.DEFAULT_WEBSOCKET_PING_INTERVAL + 10).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -754,14 +755,14 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject WebSocketPingInterval negative and non-integer', () => {
-      const negRes = manager.setVariables(mockChargingStation, [
+      const negRes = manager.setVariables(station, [
         {
           attributeValue: '-2',
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
       ])[0]
-      const nonIntRes = manager.setVariables(mockChargingStation, [
+      const nonIntRes = manager.setVariables(station, [
         {
           attributeValue: '5.7',
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -775,7 +776,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should validate EVConnectionTimeOut positive integer >0 and reject invalid', () => {
-      const okRes = manager.setVariables(mockChargingStation, [
+      const okRes = manager.setVariables(station, [
         {
           attributeValue: (Constants.DEFAULT_EV_CONNECTION_TIMEOUT + 5).toString(),
           component: { name: OCPP20ComponentName.TxCtrlr },
@@ -784,21 +785,21 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(okRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(okRes.attributeStatusInfo).toBeUndefined()
-      const zeroRes = manager.setVariables(mockChargingStation, [
+      const zeroRes = manager.setVariables(station, [
         {
           attributeValue: '0',
           component: { name: OCPP20ComponentName.TxCtrlr },
           variable: { name: OCPP20RequiredVariableName.EVConnectionTimeOut },
         },
       ])[0]
-      const negRes = manager.setVariables(mockChargingStation, [
+      const negRes = manager.setVariables(station, [
         {
           attributeValue: '-10',
           component: { name: OCPP20ComponentName.TxCtrlr },
           variable: { name: OCPP20RequiredVariableName.EVConnectionTimeOut },
         },
       ])[0]
-      const nonIntRes = manager.setVariables(mockChargingStation, [
+      const nonIntRes = manager.setVariables(station, [
         {
           attributeValue: '15.2',
           component: { name: OCPP20ComponentName.TxCtrlr },
@@ -814,30 +815,30 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should validate MessageTimeout positive integer >0 and reject invalid', () => {
-      const okRes = manager.setVariables(mockChargingStation, [
+      const okRes = manager.setVariables(station, [
         {
-          attributeValue: (mockChargingStation.getConnectionTimeout() + 5).toString(),
+          attributeValue: (station.getConnectionTimeout() + 5).toString(),
           component: { instance: 'Default', name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.MessageTimeout },
         },
       ])[0]
       expect(okRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       expect(okRes.attributeStatusInfo).toBeUndefined()
-      const zeroRes = manager.setVariables(mockChargingStation, [
+      const zeroRes = manager.setVariables(station, [
         {
           attributeValue: '0',
           component: { instance: 'Default', name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.MessageTimeout },
         },
       ])[0]
-      const negRes = manager.setVariables(mockChargingStation, [
+      const negRes = manager.setVariables(station, [
         {
           attributeValue: '-25',
           component: { instance: 'Default', name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.MessageTimeout },
         },
       ])[0]
-      const nonIntRes = manager.setVariables(mockChargingStation, [
+      const nonIntRes = manager.setVariables(station, [
         {
           attributeValue: '30.9',
           component: { instance: 'Default', name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -854,12 +855,12 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     await it('should avoid duplicate persistence operations when value unchanged', () => {
       const keyBefore = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20OptionalVariableName.HeartbeatInterval as unknown as VariableType['name']
       )
       expect(keyBefore).toBeDefined()
       const originalValue = keyBefore?.value
-      const first = manager.setVariables(mockChargingStation, [
+      const first = manager.setVariables(station, [
         {
           attributeValue: originalValue ?? '30',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -867,7 +868,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(first.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
-      const changed = manager.setVariables(mockChargingStation, [
+      const changed = manager.setVariables(station, [
         {
           attributeValue: (parseInt(originalValue ?? '30', 10) + 5).toString(),
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -876,11 +877,11 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(changed.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       const keyAfterChange = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20OptionalVariableName.HeartbeatInterval as unknown as VariableType['name']
       )
       expect(keyAfterChange?.value).not.toBe(originalValue)
-      const reverted = manager.setVariables(mockChargingStation, [
+      const reverted = manager.setVariables(station, [
         {
           attributeValue: originalValue ?? '30',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -889,7 +890,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(reverted.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       const keyAfterRevert = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20OptionalVariableName.HeartbeatInterval as unknown as VariableType['name']
       )
       expect(keyAfterRevert?.value).toBe(originalValue)
@@ -897,16 +898,16 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     await it('should add missing configuration key with default during self-check', () => {
       deleteConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.EVConnectionTimeOut as unknown as VariableType['name'],
         { save: false }
       )
       const before = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.EVConnectionTimeOut as unknown as VariableType['name']
       )
       expect(before).toBeUndefined()
-      const res = manager.getVariables(mockChargingStation, [
+      const res = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.TxCtrlr },
           variable: { name: OCPP20RequiredVariableName.EVConnectionTimeOut },
@@ -916,21 +917,21 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(res.attributeStatusInfo).toBeUndefined()
       expect(res.attributeValue).toBe(Constants.DEFAULT_EV_CONNECTION_TIMEOUT.toString())
       const after = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.EVConnectionTimeOut as unknown as VariableType['name']
       )
       expect(after).toBeDefined()
     })
 
     await it('should clear runtime overrides via resetRuntimeOverrides()', () => {
-      manager.setVariables(mockChargingStation, [
+      manager.setVariables(station, [
         {
           attributeValue: '123',
           component: { name: OCPP20ComponentName.SampledDataCtrlr },
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
         },
       ])
-      const beforeReset = manager.getVariables(mockChargingStation, [
+      const beforeReset = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SampledDataCtrlr },
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
@@ -938,7 +939,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(beforeReset.attributeValue).toBe('123')
       manager.resetRuntimeOverrides()
-      const afterReset = manager.getVariables(mockChargingStation, [
+      const afterReset = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SampledDataCtrlr },
           variable: { name: OCPP20RequiredVariableName.TxUpdatedInterval },
@@ -949,7 +950,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject HeartbeatInterval with leading whitespace', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: ' 60',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -964,7 +965,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject HeartbeatInterval with trailing whitespace', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: '60 ',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -979,7 +980,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject HeartbeatInterval with plus sign prefix', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: '+10',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -994,7 +995,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should accept HeartbeatInterval with leading zeros', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: '007',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1006,7 +1007,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject HeartbeatInterval blank string', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: '',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1021,7 +1022,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject HeartbeatInterval with internal space', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: '6 0',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1036,7 +1037,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject ConnectionUrl missing scheme', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: 'example.com/ocpp',
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1050,7 +1051,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     await it('should reject ConnectionUrl exceeding max length', () => {
       const longUrl = 'wss://example.com/' + 'a'.repeat(600)
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: longUrl,
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1065,7 +1066,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should reject HeartbeatInterval exceeding max length', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: '1'.repeat(11),
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1085,15 +1086,15 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     // Effective value size limit tests combining ConfigurationValueSize and ValueSize
     await it('should enforce ConfigurationValueSize when ValueSize unset', () => {
-      resetValueSizeLimits(mockChargingStation)
-      setConfigurationValueSize(mockChargingStation, 50)
+      resetValueSizeLimits(station)
+      setConfigurationValueSize(station, 50)
       // remove ValueSize to simulate unset
       deleteConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.ValueSize as unknown as VariableType['name'],
         { save: false }
       )
-      const okRes = manager.setVariables(mockChargingStation, [
+      const okRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(50, 'x'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1101,7 +1102,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(okRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
-      const tooLongRes = manager.setVariables(mockChargingStation, [
+      const tooLongRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(51, 'x'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1113,14 +1114,14 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should enforce ValueSize when ConfigurationValueSize unset', () => {
-      resetValueSizeLimits(mockChargingStation)
-      setValueSize(mockChargingStation, 40)
+      resetValueSizeLimits(station)
+      setValueSize(station, 40)
       deleteConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.ConfigurationValueSize as unknown as VariableType['name'],
         { save: false }
       )
-      const okRes = manager.setVariables(mockChargingStation, [
+      const okRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(40, 'y'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1128,7 +1129,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(okRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
-      const tooLongRes = manager.setVariables(mockChargingStation, [
+      const tooLongRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(41, 'y'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1140,10 +1141,10 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should use smaller of ConfigurationValueSize and ValueSize (ValueSize smaller)', () => {
-      resetValueSizeLimits(mockChargingStation)
-      setConfigurationValueSize(mockChargingStation, 60)
-      setValueSize(mockChargingStation, 55)
-      const okRes = manager.setVariables(mockChargingStation, [
+      resetValueSizeLimits(station)
+      setConfigurationValueSize(station, 60)
+      setValueSize(station, 55)
+      const okRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(55, 'z'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1151,7 +1152,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(okRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
-      const tooLongRes = manager.setVariables(mockChargingStation, [
+      const tooLongRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(56, 'z'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1163,10 +1164,10 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should use smaller of ConfigurationValueSize and ValueSize (ConfigurationValueSize smaller)', () => {
-      resetValueSizeLimits(mockChargingStation)
-      setConfigurationValueSize(mockChargingStation, 30)
-      setValueSize(mockChargingStation, 100)
-      const okRes = manager.setVariables(mockChargingStation, [
+      resetValueSizeLimits(station)
+      setConfigurationValueSize(station, 30)
+      setValueSize(station, 100)
+      const okRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(30, 'w'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1174,7 +1175,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(okRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
-      const tooLongRes = manager.setVariables(mockChargingStation, [
+      const tooLongRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(31, 'w'),
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1186,11 +1187,11 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should fallback to default limit when both invalid/non-positive', () => {
-      resetValueSizeLimits(mockChargingStation)
+      resetValueSizeLimits(station)
       // set invalid values
-      setConfigurationValueSize(mockChargingStation, 0)
-      setValueSize(mockChargingStation, -5)
-      const okRes = manager.setVariables(mockChargingStation, [
+      setConfigurationValueSize(station, 0)
+      setValueSize(station, -5)
+      const okRes = manager.setVariables(station, [
         {
           attributeValue: buildWsExampleUrl(300, 'v'), // below default absolute max length
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1242,7 +1243,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
           variable: { name: OCPP20RequiredVariableName.TxUpdatedMeasurands },
         },
       ]
-      const results = manager.setVariables(mockChargingStation, updateAttempts)
+      const results = manager.setVariables(station, updateAttempts)
       // First (FileTransferProtocols) should be rejected (ReadOnly); others accepted
       expect(results[0].attributeStatus).toBe(SetVariableStatusEnumType.Rejected)
       expect(results[0].attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.ReadOnly)
@@ -1252,7 +1253,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should retrieve FileTransferProtocols default including FTPS (ReadOnly)', () => {
-      const getRes = manager.getVariables(mockChargingStation, [
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.FileTransferProtocols },
@@ -1264,8 +1265,8 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     await it('should keep FileTransferProtocols value unchanged after rejected update attempt', () => {
       // First ensure the configuration key exists by calling getVariables (triggers self-check)
-      // Each test gets a fresh mockChargingStation, so we must initialize the configuration key
-      const initGet = manager.getVariables(mockChargingStation, [
+      // Each test gets a fresh station, so we must initialize the configuration key
+      const initGet = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.FileTransferProtocols },
@@ -1275,11 +1276,11 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(initGet.attributeValue).toBe('HTTPS,FTPS,SFTP')
 
       const beforeCfg = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.FileTransferProtocols as unknown as VariableType['name']
       )
       expect(beforeCfg?.value).toBe('HTTPS,FTPS,SFTP')
-      const rejected = manager.setVariables(mockChargingStation, [
+      const rejected = manager.setVariables(station, [
         {
           attributeValue: 'HTTP,HTTPS',
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1288,7 +1289,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(rejected.attributeStatus).toBe(SetVariableStatusEnumType.Rejected)
       expect(rejected.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.ReadOnly)
-      const afterGet = manager.getVariables(mockChargingStation, [
+      const afterGet = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.FileTransferProtocols },
@@ -1297,14 +1298,14 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(afterGet.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(afterGet.attributeValue).toBe('HTTPS,FTPS,SFTP')
       const afterCfg = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.FileTransferProtocols as unknown as VariableType['name']
       )
       expect(afterCfg?.value).toBe(beforeCfg?.value)
     })
 
     await it('should reject removed TimeSource members RTC and Manual', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: 'NTP,GPS,RTC,Manual', // RTC & Manual no longer valid
           component: { name: OCPP20ComponentName.ClockCtrlr },
@@ -1317,7 +1318,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should accept extended TimeSource including RealTimeClock and MobileNetwork', () => {
-      const res = manager.setVariables(mockChargingStation, [
+      const res = manager.setVariables(station, [
         {
           attributeValue: 'MobileNetwork,Heartbeat,NTP,GPS,RealTimeClock',
           component: { name: OCPP20ComponentName.ClockCtrlr },
@@ -1356,7 +1357,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       const invalidPatterns = ['', ',HTTP', 'HTTP,', 'HTTP,,FTP', 'HTTP,HTTP']
       for (const lv of listVariables) {
         for (const pattern of invalidPatterns) {
-          const res = manager.setVariables(mockChargingStation, [
+          const res = manager.setVariables(station, [
             {
               attributeValue: pattern,
               component: { name: lv.component },
@@ -1389,7 +1390,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
   await it('should reject DataSigned in TxStopPoint list value', () => {
     const manager = OCPP20VariableManager.getInstance()
-    const res = manager.setVariables(mockChargingStation, [
+    const res = manager.setVariables(station, [
       {
         attributeValue: 'Authorized,EVConnected,DataSigned', // DataSigned invalid for stop point enumeration
         component: { name: OCPP20ComponentName.TxCtrlr },
@@ -1439,17 +1440,17 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     const manager = OCPP20VariableManager.getInstance()
 
     await it('should truncate retrieved value using ValueSize only when ReportingValueSize absent', () => {
-      resetValueSizeLimits(mockChargingStation)
+      resetValueSizeLimits(station)
       // Ensure ReportingValueSize unset
       deleteConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.ReportingValueSize as unknown as VariableType['name'],
         { save: false }
       )
       // Temporarily set large ValueSize to allow storing long value
-      setValueSize(mockChargingStation, 200)
+      setValueSize(station, 200)
       const longUrl = buildWsExampleUrl(180, 'a')
-      const setRes = manager.setVariables(mockChargingStation, [
+      const setRes = manager.setVariables(station, [
         {
           attributeValue: longUrl,
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1458,8 +1459,8 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(setRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       // Now reduce ValueSize to 50 to force truncation at get-time
-      setValueSize(mockChargingStation, 50)
-      const getRes = manager.getVariables(mockChargingStation, [
+      setValueSize(station, 50)
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
@@ -1469,16 +1470,16 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(getRes.attributeValue?.length).toBe(50)
       // First 50 chars should match original long value prefix
       expect(longUrl.startsWith(getRes.attributeValue ?? '')).toBe(true)
-      resetValueSizeLimits(mockChargingStation)
+      resetValueSizeLimits(station)
     })
 
     await it('should apply ValueSize then ReportingValueSize sequential truncation', () => {
-      resetValueSizeLimits(mockChargingStation)
+      resetValueSizeLimits(station)
       // Store long value with large limits
-      setValueSize(mockChargingStation, 300)
-      setReportingValueSize(mockChargingStation, 250) // will be applied second
+      setValueSize(station, 300)
+      setReportingValueSize(station, 250) // will be applied second
       const longUrl = buildWsExampleUrl(260, 'b')
-      const setRes = manager.setVariables(mockChargingStation, [
+      const setRes = manager.setVariables(station, [
         {
           attributeValue: longUrl,
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1487,9 +1488,9 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(setRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       // Reduce ValueSize below ReportingValueSize to 200 so first truncation occurs at 200, then second at 150
-      setValueSize(mockChargingStation, 200)
-      setReportingValueSize(mockChargingStation, 150)
-      const getRes = manager.getVariables(mockChargingStation, [
+      setValueSize(station, 200)
+      setReportingValueSize(station, 150)
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
@@ -1498,24 +1499,24 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(getRes.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(getRes.attributeValue?.length).toBe(150)
       expect(longUrl.startsWith(getRes.attributeValue ?? '')).toBe(true)
-      resetValueSizeLimits(mockChargingStation)
-      resetReportingValueSize(mockChargingStation)
+      resetValueSizeLimits(station)
+      resetReportingValueSize(station)
     })
 
     await it('should enforce absolute max character cap after truncation chain', () => {
-      resetValueSizeLimits(mockChargingStation)
-      resetReportingValueSize(mockChargingStation)
+      resetValueSizeLimits(station)
+      resetReportingValueSize(station)
       // Directly upsert configuration key with > absolute max length value bypassing set-time limit (which rejects > absolute max length)
       const overLongValue = buildWsExampleUrl(3000, 'c')
       upsertConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20VendorVariableName.ConnectionUrl as unknown as VariableType['name'],
         overLongValue
       )
       // Set generous ValueSize (1500) and ReportingValueSize (1400) so only absolute cap applies (since both < Constants.OCPP_VALUE_ABSOLUTE_MAX_LENGTH)
-      setValueSize(mockChargingStation, 1500)
-      setReportingValueSize(mockChargingStation, 1400)
-      const getRes = manager.getVariables(mockChargingStation, [
+      setValueSize(station, 1500)
+      setReportingValueSize(station, 1400)
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
@@ -1524,20 +1525,20 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(getRes.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(getRes.attributeValue?.length).toBe(1400)
       expect(overLongValue.startsWith(getRes.attributeValue ?? '')).toBe(true)
-      resetValueSizeLimits(mockChargingStation)
-      resetReportingValueSize(mockChargingStation)
+      resetValueSizeLimits(station)
+      resetReportingValueSize(station)
     })
 
     await it('should not exceed variable maxLength even if ValueSize and ReportingValueSize set above it', () => {
-      resetValueSizeLimits(mockChargingStation)
-      resetReportingValueSize(mockChargingStation)
+      resetValueSizeLimits(station)
+      resetReportingValueSize(station)
       // Store exactly variable maxLength value via setVariables (allowed per registry/spec)
       const connectionUrlMaxLength =
         VARIABLE_REGISTRY[
           `${OCPP20ComponentName.ChargingStation}::${OCPP20VendorVariableName.ConnectionUrl}`
         ].maxLength ?? 512
       const maxLenValue = buildWsExampleUrl(connectionUrlMaxLength, 'd')
-      const setRes = manager.setVariables(mockChargingStation, [
+      const setRes = manager.setVariables(station, [
         {
           attributeValue: maxLenValue,
           component: { name: OCPP20ComponentName.ChargingStation },
@@ -1546,9 +1547,9 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       expect(setRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
       // Set larger limits that would allow a bigger value if not for variable-level maxLength
-      setValueSize(mockChargingStation, 3000)
-      setReportingValueSize(mockChargingStation, 2800)
-      const getRes = manager.getVariables(mockChargingStation, [
+      setValueSize(station, 3000)
+      setReportingValueSize(station, 2800)
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20VendorVariableName.ConnectionUrl },
@@ -1557,8 +1558,8 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(getRes.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(getRes.attributeValue?.length).toBe(connectionUrlMaxLength)
       expect(getRes.attributeValue).toBe(maxLenValue)
-      resetValueSizeLimits(mockChargingStation)
-      resetReportingValueSize(mockChargingStation)
+      resetValueSizeLimits(station)
+      resetReportingValueSize(station)
     })
   })
 
@@ -1567,16 +1568,16 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     await it('should auto-create persistent OrganizationName configuration key during self-check', () => {
       deleteConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.OrganizationName as unknown as VariableType['name'],
         { save: false }
       )
       const before = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.OrganizationName as unknown as VariableType['name']
       )
       expect(before).toBeUndefined()
-      const res = manager.getVariables(mockChargingStation, [
+      const res = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SecurityCtrlr },
           variable: { name: OCPP20RequiredVariableName.OrganizationName },
@@ -1585,7 +1586,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(res.attributeStatus).toBe(GetVariableStatusEnumType.Accepted)
       expect(res.attributeValue).toBe('Example Charging Services Ltd')
       const after = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.OrganizationName as unknown as VariableType['name']
       )
       expect(after).toBeDefined()
@@ -1593,7 +1594,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     })
 
     await it('should accept setting OrganizationName and require reboot per OCPP 2.0.1 specification', () => {
-      const setRes = manager.setVariables(mockChargingStation, [
+      const setRes = manager.setVariables(station, [
         {
           attributeValue: 'NewOrgName',
           component: { name: OCPP20ComponentName.SecurityCtrlr },
@@ -1602,7 +1603,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])[0]
       // OCPP 2.0.1 compliant behavior: OrganizationName changes require reboot
       expect(setRes.attributeStatus).toBe(SetVariableStatusEnumType.RebootRequired)
-      const getRes = manager.getVariables(mockChargingStation, [
+      const getRes = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SecurityCtrlr },
           variable: { name: OCPP20RequiredVariableName.OrganizationName },
@@ -1613,7 +1614,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
     await it('should preserve OrganizationName value after resetRuntimeOverrides()', () => {
       // First set OrganizationName to ensure it's persisted (test must be self-contained)
-      manager.setVariables(mockChargingStation, [
+      manager.setVariables(station, [
         {
           attributeValue: 'PersistenceTestOrgName',
           component: { name: OCPP20ComponentName.SecurityCtrlr },
@@ -1622,7 +1623,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       ])
       // Now reset runtime overrides
       manager.resetRuntimeOverrides()
-      const res = manager.getVariables(mockChargingStation, [
+      const res = manager.getVariables(station, [
         {
           component: { name: OCPP20ComponentName.SecurityCtrlr },
           variable: { name: OCPP20RequiredVariableName.OrganizationName },
@@ -1636,11 +1637,11 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
     await it('should create configuration key for instance-scoped MessageAttemptInterval and persist Actual value (Actual-only, no MinSet/MaxSet)', () => {
       // Ensure no configuration key exists before operations
       const cfgBefore = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.MessageAttemptInterval as unknown as VariableType['name']
       )
       expect(cfgBefore).toBeUndefined()
-      const initialGet = manager.getVariables(mockChargingStation, [
+      const initialGet = manager.getVariables(station, [
         {
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.MessageAttemptInterval },
@@ -1650,7 +1651,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(initialGet.attributeValue).toBe('5')
 
       // Negative: MinSet not supported
-      const minSetRes = manager.setVariables(mockChargingStation, [
+      const minSetRes = manager.setVariables(station, [
         {
           attributeType: AttributeEnumType.MinSet,
           attributeValue: '6',
@@ -1659,7 +1660,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(minSetRes.attributeStatus).toBe(SetVariableStatusEnumType.NotSupportedAttributeType)
-      const getMin = manager.getVariables(mockChargingStation, [
+      const getMin = manager.getVariables(station, [
         {
           attributeType: AttributeEnumType.MinSet,
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1669,7 +1670,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(getMin.attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
 
       // Negative: MaxSet not supported
-      const maxSetRes = manager.setVariables(mockChargingStation, [
+      const maxSetRes = manager.setVariables(station, [
         {
           attributeType: AttributeEnumType.MaxSet,
           attributeValue: '10',
@@ -1678,7 +1679,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
         },
       ])[0]
       expect(maxSetRes.attributeStatus).toBe(SetVariableStatusEnumType.NotSupportedAttributeType)
-      const getMax = manager.getVariables(mockChargingStation, [
+      const getMax = manager.getVariables(station, [
         {
           attributeType: AttributeEnumType.MaxSet,
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1688,7 +1689,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(getMax.attributeStatus).toBe(GetVariableStatusEnumType.NotSupportedAttributeType)
 
       // Attempt Actual value below registry min (min=1) -> reject
-      const belowMinRes = manager.setVariables(mockChargingStation, [
+      const belowMinRes = manager.setVariables(station, [
         {
           attributeValue: '0',
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1699,7 +1700,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(belowMinRes.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.ValuePositiveOnly)
 
       // Attempt Actual value above registry max (max=3600) -> reject
-      const aboveMaxRes = manager.setVariables(mockChargingStation, [
+      const aboveMaxRes = manager.setVariables(station, [
         {
           attributeValue: '3601',
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1710,7 +1711,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(aboveMaxRes.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.ValueTooHigh)
 
       // Accept Actual value within metadata bounds
-      const withinRes = manager.setVariables(mockChargingStation, [
+      const withinRes = manager.setVariables(station, [
         {
           attributeValue: '7',
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
@@ -1720,7 +1721,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(withinRes.attributeStatus).toBe(SetVariableStatusEnumType.Accepted)
 
       // Retrieval now returns persisted value '7'
-      const afterSetGet = manager.getVariables(mockChargingStation, [
+      const afterSetGet = manager.getVariables(station, [
         {
           component: { instance: 'TransactionEvent', name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.MessageAttemptInterval },
@@ -1730,7 +1731,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
       expect(afterSetGet.attributeValue).toBe('7')
 
       const cfgAfter = getConfigurationKey(
-        mockChargingStation,
+        station,
         OCPP20RequiredVariableName.MessageAttemptInterval as unknown as VariableType['name']
       )
       expect(cfgAfter).toBeDefined()
index be49d7001b2a3a8145c40d689389acdba277883f..33e45074022e1f961e03a878904cf5c993074057 100644 (file)
@@ -15,7 +15,7 @@ import {
   IdentifierType,
 } from '../../../../src/charging-station/ocpp/auth/types/AuthTypes.js'
 import { OCPPVersion } from '../../../../src/types/ocpp/OCPPVersion.js'
-import { createChargingStation } from '../../../ChargingStationFactory.js'
+import { createChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   createMockAuthRequest,
   createMockOCPP16Identifier,
index 03c56b94f8d6014c01d4a9ed5b0d762c8d89719f..c04076ab38a846e97371c865e9c10156c0f80229 100644 (file)
@@ -10,7 +10,7 @@ import type { AuthConfiguration } from '../../../../../src/charging-station/ocpp
 
 import { AuthComponentFactory } from '../../../../../src/charging-station/ocpp/auth/factories/AuthComponentFactory.js'
 import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js'
-import { createChargingStation } from '../../../../ChargingStationFactory.js'
+import { createMockChargingStation } from '../../../../ChargingStationTestUtils.js'
 import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 
 await describe('AuthComponentFactory', async () => {
@@ -20,7 +20,7 @@ await describe('AuthComponentFactory', async () => {
 
   await describe('createAdapters', async () => {
     await it('should create OCPP 1.6 adapter', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
       })
       const result = await AuthComponentFactory.createAdapters(chargingStation)
@@ -30,7 +30,7 @@ await describe('AuthComponentFactory', async () => {
     })
 
     await it('should create OCPP 2.0 adapter', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_20 },
       })
       const result = await AuthComponentFactory.createAdapters(chargingStation)
@@ -40,7 +40,7 @@ await describe('AuthComponentFactory', async () => {
     })
 
     await it('should create OCPP 2.0.1 adapter', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
       })
       const result = await AuthComponentFactory.createAdapters(chargingStation)
@@ -50,7 +50,7 @@ await describe('AuthComponentFactory', async () => {
     })
 
     await it('should throw error for unsupported version', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: 'VERSION_15' as OCPPVersion },
       })
 
@@ -60,7 +60,7 @@ await describe('AuthComponentFactory', async () => {
     })
 
     await it('should throw error when no OCPP version', async () => {
-      const chargingStation = createChargingStation()
+      const { station: chargingStation } = createMockChargingStation()
       chargingStation.stationInfo = undefined
 
       await expect(AuthComponentFactory.createAdapters(chargingStation)).rejects.toThrow(
@@ -93,7 +93,7 @@ await describe('AuthComponentFactory', async () => {
 
   await describe('createLocalAuthListManager', async () => {
     await it('should return undefined (delegated to service)', () => {
-      const chargingStation = createChargingStation()
+      const { station: chargingStation } = createMockChargingStation()
       const config: AuthConfiguration = {
         allowOfflineTxForUnknownId: false,
         authorizationCacheEnabled: false,
@@ -149,7 +149,7 @@ await describe('AuthComponentFactory', async () => {
 
   await describe('createRemoteStrategy', async () => {
     await it('should return undefined when remote auth disabled', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
       })
       const adapters = await AuthComponentFactory.createAdapters(chargingStation)
@@ -170,7 +170,7 @@ await describe('AuthComponentFactory', async () => {
     })
 
     await it('should create remote strategy when enabled', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
       })
       const adapters = await AuthComponentFactory.createAdapters(chargingStation)
@@ -196,7 +196,7 @@ await describe('AuthComponentFactory', async () => {
 
   await describe('createCertificateStrategy', async () => {
     await it('should create certificate strategy', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
       })
       const adapters = await AuthComponentFactory.createAdapters(chargingStation)
@@ -223,7 +223,7 @@ await describe('AuthComponentFactory', async () => {
 
   await describe('createStrategies', async () => {
     await it('should create only certificate strategy by default', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
       })
       const adapters = await AuthComponentFactory.createAdapters(chargingStation)
@@ -250,7 +250,7 @@ await describe('AuthComponentFactory', async () => {
     })
 
     await it('should create and sort all strategies when enabled', async () => {
-      const chargingStation = createChargingStation({
+      const { station: chargingStation } = createMockChargingStation({
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
       })
       const adapters = await AuthComponentFactory.createAdapters(chargingStation)
index e7539d8a61748affc4b47e5fa711cf427458cf8c..b8ba1420d0158ab6a5c4d8ac4a2d5d9b303a0639 100644 (file)
@@ -18,7 +18,7 @@ import {
   handleSendMessageError,
 } from '../../src/utils/ErrorUtils.js'
 import { logger } from '../../src/utils/Logger.js'
-import { createChargingStation } from '../ChargingStationFactory.js'
+import { createChargingStation } from '../charging-station/ChargingStationTestUtils.js'
 import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 
 await describe('ErrorUtils test suite', async () => {