]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(test): remove duplicate MockChargingStation interface from MockFactories
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 1 Mar 2026 22:24:35 +0000 (23:24 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 1 Mar 2026 22:24:35 +0000 (23:24 +0100)
- Delete unused MockChargingStation interface (duplicate of StationHelpers.ts)
- Delete unused createMockAuthChargingStation factory function
- Keep createMockAuthServiceTestStation which is actively used (34 calls)

tests/charging-station/ocpp/auth/helpers/MockFactories.ts

index 7c6b9fca7a43f98e2fb905e06b09ab7f2e302d5e..60470de0a9dfce2b3ecaca1aa19a6c6d0cb7d62d 100644 (file)
@@ -268,47 +268,6 @@ export const createTestAuthConfig = (
 // ChargingStation Mock
 // ============================================================================
 
-/**
- * Minimal ChargingStation interface for auth module testing.
- * Contains only the properties needed by auth strategies and services.
- */
-export interface MockChargingStation {
-  getConnectorStatus: (connectorId: number) => undefined | { status: string }
-  idTagLocalAuthorized: (idTag: string) => boolean
-  isConnected: () => boolean
-  logPrefix: () => string
-  ocppVersion: OCPPVersion
-  sendRequest: (commandName: string, payload: unknown) => Promise<unknown>
-  stationInfo: {
-    chargingStationId: string
-    hashId: string
-  }
-}
-
-/**
- * Create a mock ChargingStation for auth module unit testing.
- *
- * Returns MockChargingStation interface - minimal interface for auth strategies.
- * For OCPPAuthService tests requiring full ChargingStation type, use createMockAuthServiceTestStation().
- * @param overrides - Partial MockChargingStation properties to override defaults
- * @returns Mock ChargingStation object with stubbed methods
- */
-export const createMockAuthChargingStation = (
-  overrides?: Partial<MockChargingStation>
-): MockChargingStation => ({
-  getConnectorStatus: () => ({ status: 'Available' }),
-  idTagLocalAuthorized: () => false,
-  isConnected: () => true,
-  logPrefix: () => '[MockStation]',
-  ocppVersion: OCPPVersion.VERSION_16,
-  sendRequest: () => Promise.resolve({}),
-  stationInfo: {
-    chargingStationId: 'test-station-001',
-    hashId: 'test-hash-001',
-  },
-  ...overrides,
-})
-
 /**
  * Create a mock ChargingStation for auth service testing.
  * Provides minimal station interface needed for OCPPAuthServiceImpl tests.