]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(tests): ensure proper test isolation and cleanup
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 17:03:01 +0000 (18:03 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 17:03:01 +0000 (18:03 +0100)
commit7bd734261cb86ceee70acf87146ec25ffdec072c
treedd1bf9fd05256c2d953127a2e93444aaf430cb22
parent7cd70f39190b6f1ddab9a27ea2c8b54cbe2ab634
fix(tests): ensure proper test isolation and cleanup

Add afterEach hooks to reset singleton state and clear factory caches
between tests, preventing state leakage across test files.

Changes:
- OCPP20VariableManager.test.ts: Reset runtime overrides after each test
- OCPPAuthServiceFactory.test.ts: Clear all cached instances after each test
- OCPP20IncomingRequestService-SetVariables.test.ts: Reset variable manager
- OCPP20IncomingRequestService-GetVariables.test.ts: Reset variable manager
- OCPP20IncomingRequestService-GetBaseReport.test.ts: Reset variable manager

Verified: All 280 tests pass on consecutive runs (test && test)
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts
tests/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.test.ts