]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(tests): align mock delete/stop signatures with async ChargingStation interface
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 02:11:29 +0000 (03:11 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 14:00:18 +0000 (15:00 +0100)
- Change delete() to async, return Promise<void>, await stop()
- Change stop() to async, return Promise<void>
- Add await Promise.resolve() for lint compliance in mock

tests/charging-station/ChargingStationTestUtils.ts

index b595054b36c518235ed233f41983f01df76c3991..ca39f17ef9bff1c3e89accdfdb0a7baf1f2c9970 100644 (file)
@@ -561,9 +561,9 @@ export function createRealChargingStation (
       }
     },
     connectors,
-    delete (deleteConfiguration = true): void {
+    async delete (deleteConfiguration = true): Promise<void> {
       if (this.started) {
-        this.stop()
+        await this.stop()
       }
       this.requests.clear()
       this.connectors.clear()
@@ -731,10 +731,11 @@ export function createRealChargingStation (
       templateIndex: index,
       templateName: templateFile,
     },
-    stop (): void {
+    async stop (): Promise<void> {
       if (this.started && !this.stopping) {
         this.stopping = true
-        // Simulate real stop behavior
+        // Simulate async stop behavior (immediate resolution for tests)
+        await Promise.resolve()
         this.closeWSConnection()
         delete this.bootNotificationResponse
         this.started = false