From 900dccd96c75d1ecbce83b9dc36da9092a0d251a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 28 Feb 2026 19:42:13 +0100 Subject: [PATCH] refactor(tests): migrate OCPP20TestUtils to createMockChargingStation --- tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts b/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts index b447bd12..79342b2f 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts @@ -18,8 +18,8 @@ import { } from '../../../../src/types/index.js' import { OCPP20IdTokenEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' -import { createChargingStation } from '../../../ChargingStationFactory.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' +import { createMockChargingStation } from '../../ChargingStationTestUtils.js' // ============================================================================ // Testable Interfaces @@ -78,7 +78,7 @@ export interface TestableOCPP20RequestService { * @returns ChargingStation configured for OCPP 2.0 transaction testing */ export function createMockOCPP20TransactionTestStation (): ChargingStation { - return createChargingStation({ + const { station } = createMockChargingStation({ baseName: TEST_CHARGING_STATION_BASE_NAME, connectorsCount: 3, evseConfiguration: { evsesCount: 3 }, @@ -92,6 +92,7 @@ export function createMockOCPP20TransactionTestStation (): ChargingStation { }, websocketPingInterval: Constants.DEFAULT_WEBSOCKET_PING_INTERVAL, }) + return station } /** @@ -117,7 +118,7 @@ export function createMockStationWithRequestTracking (): MockStationWithTracking } ) - const station = createChargingStation({ + const { station } = createMockChargingStation({ baseName: TEST_CHARGING_STATION_BASE_NAME, connectorsCount: 3, evseConfiguration: { evsesCount: 3 }, @@ -643,8 +644,11 @@ export const TransactionFlowPatterns: TransactionFlowPattern[] = [ * @returns ChargingStation with certificateManager property properly typed * @example * ```typescript - * const station = createStationWithCertificateManager( - * createChargingStation({ ocppVersion: OCPPVersion.VERSION_201 }), + * const { station } = createMockChargingStation({ + * stationInfo: { ocppVersion: OCPPVersion.VERSION_201 } + * }) + * const stationWithCerts = createStationWithCertificateManager( + * station, * createMockCertificateManager() * ) * ``` -- 2.43.0