]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(tests): fix TypeScript errors in auth and variable manager tests
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 20:02:51 +0000 (21:02 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 20:02:51 +0000 (21:02 +0100)
- Fixed OCPPAuthIntegration.test.ts to use createMockChargingStation with destructuring
- Corrected import path in AuthComponentFactory.test.ts (../../../../ → ../../../)
- Fixed OCPP20VariableManager.test.ts type errors by properly extracting .station property
- All 291 tests passing
- Zero migration-related TypeScript compilation errors

Task 9 complete

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

index 1d8eb1c4638b9fb1e55bf2b39c5e91db3c30c2ef..2bed59d4e532c425efa0a306f2656440b2266059 100644 (file)
@@ -11,6 +11,7 @@ import {
   deleteConfigurationKey,
   getConfigurationKey,
 } from '../../../../src/charging-station/ConfigurationKeyUtils.js'
+import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js'
 import { createTestableVariableManager } from '../../../../src/charging-station/ocpp/2.0/__testable__/index.js'
 import { OCPP20VariableManager } from '../../../../src/charging-station/ocpp/2.0/OCPP20VariableManager.js'
 import { VARIABLE_REGISTRY } from '../../../../src/charging-station/ocpp/2.0/OCPP20VariableRegistry.js'
@@ -64,7 +65,7 @@ function buildWsExampleUrl (targetLength: number, fillerChar = 'a'): string {
 
 await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
   // Type declaration for mock ChargingStation
-  let station: ReturnType<typeof createMockChargingStation>
+  let station: ChargingStation
 
   // Initialize mock ChargingStation before each test
   beforeEach(() => {
@@ -1404,7 +1405,7 @@ await describe('B05/B06 - OCPP20VariableManager test suite', async () => {
 
   await describe('Unsupported MinSet/MaxSet attribute tests', async () => {
     const manager = OCPP20VariableManager.getInstance()
-    const station = createChargingStation({
+    const { station } = createMockChargingStation({
       baseName: 'MMStation',
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
index 33e45074022e1f961e03a878904cf5c993074057..0b5774591250268bfca9f7c004944155f59cf7a0 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 '../../ChargingStationTestUtils.js'
+import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 import {
   createMockAuthRequest,
   createMockOCPP16Identifier,
@@ -28,7 +28,7 @@ await describe('OCPP Authentication Integration Tests', async () => {
 
   beforeEach(() => {
     // Create mock charging station with OCPP 1.6 configuration
-    mockChargingStation16 = createChargingStation({
+    const result16 = createMockChargingStation({
       baseName: 'TEST_AUTH_CS_16',
       connectorsCount: 2,
       stationInfo: {
@@ -37,9 +37,10 @@ await describe('OCPP Authentication Integration Tests', async () => {
         templateName: 'test-auth-template',
       },
     })
+    mockChargingStation16 = result16.station
 
     // Create mock charging station with OCPP 2.0 configuration
-    mockChargingStation20 = createChargingStation({
+    const result20 = createMockChargingStation({
       baseName: 'TEST_AUTH_CS_20',
       connectorsCount: 2,
       stationInfo: {
@@ -48,6 +49,7 @@ await describe('OCPP Authentication Integration Tests', async () => {
         templateName: 'test-auth-template',
       },
     })
+    mockChargingStation20 = result20.station
   })
 
   afterEach(() => {
index c04076ab38a846e97371c865e9c10156c0f80229..5347d944de4a171107d59adfbde316d53bad774b 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 { createMockChargingStation } from '../../../../ChargingStationTestUtils.js'
+import { createMockChargingStation } from '../../../ChargingStationTestUtils.js'
 import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 
 await describe('AuthComponentFactory', async () => {