]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(tests): bind method reference in ClearCache test
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 20:05:21 +0000 (21:05 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 20:05:21 +0000 (21:05 +0100)
- Use .bind() for deleteIdTags method reference (line 89)
- Ensures proper 'this' context when method is restored and called
- Reduces lint errors from 41 to 40 (1 error fixed)
- All 291 tests still passing

tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts

index 1fb02a07c3c6620983cfed589e5e1731447a2acd..d1e9b2f621f02c711d4a6ea13c6de717284cbddf 100644 (file)
@@ -86,7 +86,7 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
     await it('Should NOT call idTagsCache.deleteIdTags() on ClearCache request', async () => {
       // Verify that IdTagsCache is not touched
       let deleteIdTagsCalled = false
-      const originalDeleteIdTags = mockChargingStation.idTagsCache.deleteIdTags
+      const originalDeleteIdTags = mockChargingStation.idTagsCache.deleteIdTags.bind(mockChargingStation.idTagsCache)
 
       Object.assign(mockChargingStation.idTagsCache, {
         deleteIdTags: () => {