More strict boolean checks
[e-mobility-charging-stations-simulator.git] / src / charging-station / ChargingStation.ts
index 40b846217556023b671d8f31a0f5d7996cc2bd0c..7b98ed35858bd4c524cccb1af9222c0100e3922b 100644 (file)
@@ -216,7 +216,10 @@ export default class ChargingStation {
   }
 
   public isRegistered(): boolean {
-    return !this.isInUnknownState() && (this.isInAcceptedState() || this.isInPendingState());
+    return (
+      this.isInUnknownState() === false &&
+      (this.isInAcceptedState() === true || this.isInPendingState() === true)
+    );
   }
 
   public isChargingStationAvailable(): boolean {
@@ -1326,7 +1329,7 @@ export default class ChargingStation {
       logger.info(
         `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} succeeded`
       );
-      if (!this.isRegistered()) {
+      if (this.isRegistered() === false) {
         // Send BootNotification
         let registrationRetryCount = 0;
         do {
@@ -1336,7 +1339,7 @@ export default class ChargingStation {
           >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
             skipBufferingOnError: true,
           });
-          if (!this.isRegistered()) {
+          if (this.isRegistered() === false) {
             this.getRegistrationMaxRetries() !== -1 && registrationRetryCount++;
             await Utils.sleep(
               this.bootNotificationResponse?.interval
@@ -1345,12 +1348,12 @@ export default class ChargingStation {
             );
           }
         } while (
-          !this.isRegistered() &&
+          this.isRegistered() === false &&
           (registrationRetryCount <= this.getRegistrationMaxRetries() ||
             this.getRegistrationMaxRetries() === -1)
         );
       }
-      if (this.isRegistered()) {
+      if (this.isRegistered() === true) {
         if (this.isInAcceptedState()) {
           await this.startMessageSequence();
         }
@@ -1764,8 +1767,7 @@ export default class ChargingStation {
       } else if (
         !this.getConnectorStatus(connectorId)?.status &&
         (this.isChargingStationAvailable() === false ||
-          (this.isChargingStationAvailable() === true &&
-            this.isConnectorAvailable(connectorId) === false))
+          this.isConnectorAvailable(connectorId) === false)
       ) {
         chargePointStatus = ChargePointStatus.UNAVAILABLE;
       } else if (