]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(tests): sync mock signatures with real async implementations
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 15:44:28 +0000 (17:44 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 15:44:48 +0000 (17:44 +0200)
Two mocks returned Promises from sync functions instead of using async,
mismatching the real method signatures of sendTransactionEvent and
requestHandler.

tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts
tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts

index b77a00a92b85a95ca16c7c7b351cc1408154e7a9..297a27fee8e96d73914eed9bd1e74ac99ae4e25e 100644 (file)
@@ -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'))
index 985b031509d12a323832ec07a2f40bf13cf29916..b190b72ecd43cf19fde78f82747186be89b71efa 100644 (file)
@@ -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,