From 4a2440bd3be536a8c0a1f65fb4ad92732baf0a3e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 27 Feb 2026 20:49:18 +0100 Subject: [PATCH] chore(tests): auto-fix lint errors (sorting and unused imports) - Fix export ordering in ChargingStationTestUtils.ts - Fix object property sorting in OCPPAuthIntegration.test.ts - Reduces lint errors from 61 to 50 (11 auto-fixed) - All 291 tests still passing --- .../ChargingStationTestUtils.ts | 10 +++++----- .../ocpp/auth/OCPPAuthIntegration.test.ts | 20 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/charging-station/ChargingStationTestUtils.ts b/tests/charging-station/ChargingStationTestUtils.ts index 8f88d154..df1ece2e 100644 --- a/tests/charging-station/ChargingStationTestUtils.ts +++ b/tests/charging-station/ChargingStationTestUtils.ts @@ -12,17 +12,12 @@ * @see tests/charging-station/ChargingStationTestConstants.ts for test constants */ -// Re-export all mock classes -export { MockWebSocket, WebSocketReadyState } from './mocks/MockWebSocket.js' -export { MockIdTagsCache, MockSharedLRUCache } from './mocks/MockCaches.js' - // Re-export all helper functions and types export type { ChargingStationMocks, MockChargingStationOptions, MockChargingStationResult, } from './helpers/StationHelpers.js' - export { cleanupChargingStation, createMockChargingStation, @@ -30,3 +25,8 @@ export { resetChargingStationState, waitForCondition, } from './helpers/StationHelpers.js' + +export { MockIdTagsCache, MockSharedLRUCache } from './mocks/MockCaches.js' + +// Re-export all mock classes +export { MockWebSocket, WebSocketReadyState } from './mocks/MockWebSocket.js' diff --git a/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts b/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts index b117516a..ba91b4b1 100644 --- a/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts +++ b/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts @@ -169,9 +169,9 @@ await describe('OCPP Authentication Integration Tests', async () => { await it('should authenticate with valid identifier', async () => { const authService = new OCPPAuthServiceImpl(mockChargingStation16) const request = createMockAuthRequest({ - identifier: createMockOCPP16Identifier('VALID_ID_123'), connectorId: 1, context: AuthContext.TRANSACTION_START, + identifier: createMockOCPP16Identifier('VALID_ID_123'), }) const result = await authService.authenticate(request) @@ -194,9 +194,9 @@ await describe('OCPP Authentication Integration Tests', async () => { for (const context of contexts) { const request = createMockAuthRequest({ - identifier: createMockOCPP16Identifier(`CONTEXT_TEST_${context}`), connectorId: 1, context, + identifier: createMockOCPP16Identifier(`CONTEXT_TEST_${context}`), }) const result = await authService.authenticate(request) @@ -208,8 +208,8 @@ await describe('OCPP Authentication Integration Tests', async () => { await it('should authorize request directly', async () => { const authService = new OCPPAuthServiceImpl(mockChargingStation16) const request = createMockAuthRequest({ - identifier: createMockOCPP16Identifier('AUTH_DIRECT_TEST'), connectorId: 1, + identifier: createMockOCPP16Identifier('AUTH_DIRECT_TEST'), }) const result = await authService.authorize(request) @@ -222,9 +222,9 @@ await describe('OCPP Authentication Integration Tests', async () => { await it('should authenticate with valid identifier', async () => { const authService = new OCPPAuthServiceImpl(mockChargingStation20) const request = createMockAuthRequest({ - identifier: createMockOCPP20Identifier('VALID_ID_456'), connectorId: 2, context: AuthContext.TRANSACTION_START, + identifier: createMockOCPP20Identifier('VALID_ID_456'), }) const result = await authService.authenticate(request) @@ -246,9 +246,9 @@ await describe('OCPP Authentication Integration Tests', async () => { for (const context of contexts) { const request = createMockAuthRequest({ - identifier: createMockOCPP20Identifier(`V20_CONTEXT_${context}`), connectorId: 2, context, + identifier: createMockOCPP20Identifier(`V20_CONTEXT_${context}`), }) const result = await authService.authenticate(request) @@ -262,13 +262,13 @@ await describe('OCPP Authentication Integration Tests', async () => { await it('should handle invalid identifier gracefully', async () => { const authService = new OCPPAuthServiceImpl(mockChargingStation16) const request = createMockAuthRequest({ + connectorId: 999, // Invalid connector + context: AuthContext.TRANSACTION_START, identifier: { ocppVersion: OCPPVersion.VERSION_16, type: IdentifierType.ISO14443, value: '', // Invalid empty value }, - connectorId: 999, // Invalid connector - context: AuthContext.TRANSACTION_START, }) const result = await authService.authenticate(request) @@ -349,8 +349,8 @@ await describe('OCPP Authentication Integration Tests', async () => { for (let i = 0; i < requestCount; i++) { const request = createMockAuthRequest({ - identifier: createMockOCPP16Identifier(`PERF_TEST_${String(i)}`), connectorId: 1, + identifier: createMockOCPP16Identifier(`PERF_TEST_${String(i)}`), }) promises.push(authService.authenticate(request)) } @@ -406,9 +406,9 @@ await describe('OCPP Authentication Integration Tests', async () => { const mockService = createMockAuthService({ authorize: () => Promise.resolve({ - status: AuthorizationStatus.BLOCKED, - method: AuthenticationMethod.REMOTE_AUTHORIZATION, isOffline: false, + method: AuthenticationMethod.REMOTE_AUTHORIZATION, + status: AuthorizationStatus.BLOCKED, timestamp: new Date(), }), }) -- 2.43.0