]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
docs(tests): update TEST_STYLE_GUIDE to reference new factory
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 20:04:10 +0000 (21:04 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 20:04:10 +0000 (21:04 +0100)
- Updated TEST_STYLE_GUIDE.md to use createMockChargingStation
- Fixed comment in ChargingStationTestUtils.ts
- Removed references to deleted ChargingStationFactory.ts

Final cleanup complete

tests/TEST_STYLE_GUIDE.md
tests/charging-station/ChargingStationTestUtils.ts

index 886c407b2876798e547cdb5150acc48c609f25a6..8c037187f609935b495a546502daf18521809ba3 100644 (file)
@@ -253,16 +253,16 @@ const TEST_STATION_NAME = 'CS-TEST-001' // Duplicate constant
 
 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,
 })
@@ -275,7 +275,7 @@ The following utilities are available for reuse across test files:
 | 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    |
index 7c536b71e92a832ce560b30a0b71916b47c814e2..4d27ced11438d6763694c63d86c12fc844045271 100644 (file)
@@ -8,7 +8,7 @@
  * - 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
  */
 
@@ -38,7 +38,6 @@ export {
   waitForCondition,
 } from './helpers/StationHelpers.js'
 
-
 export { MockIdTagsCache, MockSharedLRUCache } from './mocks/MockCaches.js'
 // Re-export all mock classes
 export { MockWebSocket, WebSocketReadyState } from './mocks/MockWebSocket.js'