From: Jérôme Benoit Date: Fri, 17 Apr 2026 15:44:28 +0000 (+0200) Subject: fix(tests): sync mock signatures with real async implementations X-Git-Tag: cli@v4.5.0~33 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=02ff5f5788a9205d56e049ac5c6303c81b78c021;p=e-mobility-charging-stations-simulator.git fix(tests): sync mock signatures with real async implementations Two mocks returned Promises from sync functions instead of using async, mismatching the real method signatures of sendTransactionEvent and requestHandler. --- diff --git a/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts b/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts index b77a00a9..297a27fe 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts @@ -2599,7 +2599,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => { } const originalSend = OCPP20ServiceUtils.sendTransactionEvent.bind(OCPP20ServiceUtils) - const sendMock = mock.method(OCPP20ServiceUtils, 'sendTransactionEvent', () => { + const sendMock = mock.method(OCPP20ServiceUtils, 'sendTransactionEvent', async () => { sendMock.mock.restore() OCPP20ServiceUtils.sendTransactionEvent = originalSend return Promise.reject(new Error('Network failure')) diff --git a/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts b/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts index 985b0315..b190b72e 100644 --- a/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts +++ b/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts @@ -209,7 +209,7 @@ await describe('OCPP20AuthAdapter', async () => { // Mock requestHandler to return accepted authorization mockStation.ocppRequestService = { - requestHandler: mock.fn(() => + requestHandler: mock.fn(async () => Promise.resolve({ idTokenInfo: { status: OCPP20AuthorizationStatusEnumType.Accepted,