]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(auth): remove unnecessary async from sync interface methods
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 30 Mar 2026 22:59:34 +0000 (00:59 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 30 Mar 2026 22:59:34 +0000 (00:59 +0200)
commitb6db2cab118c7669ccfeedda71509f09825ecab4
tree98479e1ac4ea3727bf49a12c15992c542362594a
parente3ea37160d9fd43484f6cb0ef743ddb4fb3352f1
fix(auth): remove unnecessary async from sync interface methods

isRemoteAvailable() was declared as boolean | Promise<boolean> in the
OCPPAuthAdapter interface while both implementations return boolean
synchronously. This forced unnecessary await, Promise.resolve() wrappers,
and async propagation through the call chain.

Fix the interface to boolean and cascade through:
- RemoteAuthStrategy: getStats(), testConnectivity(), checkRemoteAvailability()
  become synchronous
- AuthStrategy.getStats(): JsonObject | Promise<JsonObject> becomes JsonObject
- OCPPAuthService.getStats(): Promise<AuthStats> becomes AuthStats
- OCPPAuthServiceImpl.getStats() becomes synchronous

Update mocks and tests to match sync signatures.
src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts
src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts
src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts
tests/charging-station/ocpp/auth/helpers/MockFactories.ts
tests/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.test.ts
tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts
tests/helpers/OCPPAuthIntegrationTest.ts