]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor(tests): add shared test helpers and fixtures for DRY compliance
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 14:31:06 +0000 (15:31 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 14:34:49 +0000 (15:34 +0100)
commit950460d07dca174b4d474b0c926d0157c3664ee4
tree2f8ace030b3dab211f1df9af48dd8d1138277771
parent7513f6339b33c863f11a0187dba41a5966789166
refactor(tests): add shared test helpers and fixtures for DRY compliance

- Add timer helpers (withMockTimers, createTimerScope) in TestLifecycleHelpers.ts
- Add auth mock factories (createTestAuthConfig, createMockAuthCache, etc.) in MockFactories.ts
- Add transaction fixtures (IdTokenFixtures, TransactionContextFixtures) in OCPP20TestUtils.ts
- Add request tracking helper (createMockStationWithRequestTracking) for OCPP tests
- Refactor AuthStrategy tests to use shared factories (~490 LOC saved)
- Refactor TransactionEvent tests to use shared fixtures and helpers

14 files changed, 585 insertions(+), 752 deletions(-) = 167 net LOC saved
14 files changed:
tests/charging-station/ChargingStation-Configuration.test.ts
tests/charging-station/ChargingStation-Transactions.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent-CableFirst.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent-IdTokenFirst.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent-Offline.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent-Periodic.test.ts
tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts
tests/charging-station/ocpp/auth/helpers/MockFactories.ts
tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts
tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts
tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts
tests/helpers/TestLifecycleHelpers.ts
tests/utils/Utils.test.ts
tests/worker/WorkerUtils.test.ts