Use centralized mock factories for complex objects:
-- `createChargingStation()` - From `ChargingStationFactory.ts`
+- `createMockChargingStation()` - From `ChargingStationTestUtils.ts` (returns `{ station, mocks }`)
- `createMockChargingStation()` - From `ChargingStationTestUtils.ts`
- Auth mocks - From `tests/charging-station/ocpp/auth/helpers/MockFactories.ts`
**Example:**
```typescript
-import { createChargingStation } from '../ChargingStationFactory.js'
+import { createMockChargingStation } from './ChargingStationTestUtils.js'
-const station = await createChargingStation({
+const { station } = createMockChargingStation({
ocppVersion: OCPPVersion.VERSION_20,
numberOfConnectors: 2,
})
| Utility | Location | Purpose |
| --------------------------------------- | ------------------------------------ | -------------------------------------------- |
| `createMockChargingStation()` | `ChargingStationTestUtils.ts` | Lightweight mock station stub |
-| `createChargingStation()` | `ChargingStationFactory.ts` | Full test station with OCPP services |
+| `createMockChargingStation()` | `ChargingStationTestUtils.ts` | Full test station with OCPP services + mocks |
| `createConnectorStatus()` | `helpers/StationHelpers.ts` | ConnectorStatus factory with defaults |
| `createStationWithCertificateManager()` | `ocpp/2.0/OCPP20TestUtils.ts` | Station with certificate manager (type-safe) |
| `MockWebSocket` | `mocks/MockWebSocket.ts` | WebSocket simulation with message capture |
* - MockWebSocket: Captures sent messages for assertion
* - Singleton mocking: Overrides getInstance() for shared caches
* - Cleanup utilities: Prevents test pollution via timer/listener cleanup
- * @see tests/ChargingStationFactory.ts for mock factory (creates mock objects)
+ * @see tests/charging-station/helpers/StationHelpers.ts for mock factory implementation
* @see tests/charging-station/ChargingStationTestConstants.ts for test constants
*/
waitForCondition,
} from './helpers/StationHelpers.js'
-
export { MockIdTagsCache, MockSharedLRUCache } from './mocks/MockCaches.js'
// Re-export all mock classes
export { MockWebSocket, WebSocketReadyState } from './mocks/MockWebSocket.js'