]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(tests): remove unused mock imports after cleanup refactor
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 23:54:34 +0000 (00:54 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 28 Feb 2026 23:54:34 +0000 (00:54 +0100)
Removed ', mock' from imports in 31 test files where mock.restoreAll()
was previously removed but the import remained, causing ESLint
'no-unused-vars' errors.

35 files changed:
tests/TEST_STYLE_GUIDE.md
tests/charging-station/ConfigurationKeyUtils.test.ts
tests/charging-station/Helpers.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts
tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts
tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts
tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts
tests/charging-station/ocpp/auth/cache/InMemoryAuthCache.test.ts
tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts
tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts
tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts
tests/charging-station/ocpp/auth/types/AuthTypes.test.ts
tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts
tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts
tests/charging-station/ocpp/auth/utils/ConfigValidator.test.ts
tests/charging-station/ui-server/UIHttpServer.test.ts
tests/charging-station/ui-server/UIServerSecurity.test.ts
tests/charging-station/ui-server/UIWebSocketServer.test.ts
tests/charging-station/ui-server/ui-services/AbstractUIService.test.ts
tests/exception/BaseError.test.ts
tests/exception/OCPPError.test.ts
tests/types/ConfigurationData.test.ts
tests/utils/AsyncLock.test.ts
tests/utils/ElectricUtils.test.ts
tests/utils/StatisticUtils.test.ts

index ec7bec7c0ce35a73e3a831286f13f8321edb6124..2ef5f334ef8694e3b5a843fd042caf63d23fc787 100644 (file)
@@ -257,13 +257,15 @@ expect(mocks.webSocket.sentMessages).toContain(expectedMessage)
 
 ### Lifecycle Helpers (`helpers/TestLifecycleHelpers.ts`)
 
-| Utility                           | Purpose                              |
-| --------------------------------- | ------------------------------------ |
-| `standardCleanup()`               | **MANDATORY** afterEach cleanup      |
-| `withMockTimers()`                | Execute test with timer mocking      |
-| `createTimerScope()`              | Manual timer control                 |
-| `setupConnectorWithTransaction()` | Setup connector in transaction state |
-| `clearConnectorTransaction()`     | Clear connector transaction state    |
+| Utility                           | Purpose                                  |
+| --------------------------------- | ---------------------------------------- |
+| `standardCleanup()`               | **MANDATORY** afterEach cleanup          |
+| `withMockTimers()`                | Execute test with timer mocking          |
+| `createTimerScope()`              | Manual timer control                     |
+| `createLoggerMocks()`             | Create logger spies (error, warn)        |
+| `createConsoleMocks()`            | Create console spies (error, warn, info) |
+| `setupConnectorWithTransaction()` | Setup connector in transaction state     |
+| `clearConnectorTransaction()`     | Clear connector transaction state        |
 
 ### Mock Classes (`mocks/`)
 
index b41f6fac5828e377ccbd52af1425efc03bdc574e..cd38d7139ed9b17eb0600d1594a3ab906915168e 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for OCPP configuration key management utilities
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import type { ChargingStationOcppConfiguration } from '../../src/types/index.js'
 
@@ -25,7 +25,6 @@ const VALUE_B = 'ValueB'
 await describe('ConfigurationKeyUtils', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await describe('GetConfigurationKey', async () => {
     await it('should return undefined when configurationKey array is missing', () => {
index f9e74affa453a692d284356270b447e9260003ba..a778d26b71279d9d4bfcf030d874b5410586b4a6 100644 (file)
@@ -61,14 +61,12 @@ await describe('Helpers', async () => {
     }) as Reservation
 
   await it('should return formatted charging station ID with index', () => {
-    // Arrange & Act & Assert
     expect(getChargingStationId(1, chargingStationTemplate)).toBe(
       `${TEST_CHARGING_STATION_BASE_NAME}-00001`
     )
   })
 
   await it('should return consistent hash ID for same template and index', () => {
-    // Arrange & Act & Assert
     expect(getHashId(1, chargingStationTemplate)).toBe(
       'b4b1e8ec4fca79091d99ea9a7ea5901548010e6c0e98be9296f604b9d68734444dfdae73d7d406b6124b42815214d088'
     )
@@ -488,7 +486,6 @@ await describe('Helpers', async () => {
   })
 
   await it('should return correct phase rotation value for connector and phase count', () => {
-    // Arrange & Act & Assert
     expect(getPhaseRotationValue(0, 0)).toBe('0.RST')
     expect(getPhaseRotationValue(1, 0)).toBe('1.NotApplicable')
     expect(getPhaseRotationValue(2, 0)).toBe('2.NotApplicable')
@@ -504,7 +501,6 @@ await describe('Helpers', async () => {
   })
 
   await it('should return -1 for undefined EVSEs and 0 for empty object', () => {
-    // Arrange & Act & Assert
     expect(getMaxNumberOfEvses(undefined)).toBe(-1)
     expect(getMaxNumberOfEvses({})).toBe(0)
   })
@@ -664,35 +660,29 @@ await describe('Helpers', async () => {
 
   // Tests for reservation helper functions
   await it('should return true when reservation has expired', () => {
-    // Arrange & Act & Assert
     expect(hasReservationExpired(createTestReservation(true))).toBe(true)
   })
 
   await it('should return false when reservation is still valid', () => {
-    // Arrange & Act & Assert
     expect(hasReservationExpired(createTestReservation(false))).toBe(false)
   })
 
   await it('should return false when connector has no reservation', () => {
-    // Arrange & Act & Assert
     const connectorStatus = {} as ConnectorStatus
     expect(hasPendingReservation(connectorStatus)).toBe(false)
   })
 
   await it('should return true when connector has valid pending reservation', () => {
-    // Arrange & Act & Assert
     const connectorStatus = { reservation: createTestReservation(false) } as ConnectorStatus
     expect(hasPendingReservation(connectorStatus)).toBe(true)
   })
 
   await it('should return false when connector reservation has expired', () => {
-    // Arrange & Act & Assert
     const connectorStatus = { reservation: createTestReservation(true) } as ConnectorStatus
     expect(hasPendingReservation(connectorStatus)).toBe(false)
   })
 
   await it('should return false when no reservations exist (connector mode)', () => {
-    // Arrange & Act & Assert
     const { station: chargingStation } = createMockChargingStation({
       connectorsCount: 2,
       TEST_CHARGING_STATION_BASE_NAME,
index dc8842207957f3906b0e17a497e06c15a9138ea6..b9f94c39b0401f9c847dbe3bc078f2cc042415d3 100644 (file)
@@ -85,7 +85,6 @@ await describe('I04 - CertificateSigned', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await describe('Valid Certificate Chain Installation', async () => {
     await it('should accept valid certificate chain', async () => {
index d4ad89d77fd11029c0d02cffafa6db7468e1787c..9d47f93b46c31055fac5f4daaa74fbe569ef43b4 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 
@@ -20,7 +20,6 @@ import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
 await describe('C11 - Clear Authorization Data in Authorization Cache', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   let station: ChargingStation
index 9a9f496e3ee08cf0c225a685f1e93a8e35e51aa6..5d0317b03c8fcc0118ea5576cc9e768e83246880 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type { ChargingStationWithCertificateManager } from '../../../../src/charging-station/ocpp/2.0/OCPP20CertificateManager.js'
@@ -45,7 +45,6 @@ const NONEXISTENT_CERTIFICATE_HASH_DATA = {
 await describe('I04 - DeleteCertificate', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   let station: ChargingStation
index 98178b234c85bd26a0ebd004e854c38acf11eac4..4bd9651fc791746b09a0a901aa601b099deb523e 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type { ChargingStationWithCertificateManager } from '../../../../src/charging-station/ocpp/2.0/OCPP20CertificateManager.js'
@@ -76,7 +76,6 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await describe('Request All Certificate Types', async () => {
index 750d095fb3accfe46b930c411764e48886fab2a5..3a2e6ce25496c8208aa91d038b076fa18457e255 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type { ChargingStationWithCertificateManager } from '../../../../src/charging-station/ocpp/2.0/OCPP20CertificateManager.js'
@@ -55,7 +55,6 @@ SIb3DQEBCwUAA0EAexpired==
 await describe('I03 - InstallCertificate', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   let mockChargingStation: ChargingStation
index 456381c1ece3c22aec2df3db2e06b7617e65d62e..597aa22c071475efe47f01ee470484c1784178c9 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for OCPP 2.0 BootNotification request building (B01)
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 
@@ -61,7 +61,6 @@ await describe('B01 - Cold Boot Charging Station', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   // FR: B01.FR.01
index 00b1c0e170d553552158f81841aa9348b20b1db7..c954292a425e88552121bdabe709231cac6b242d 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for OCPP 2.0 Heartbeat request building (G02)
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 
@@ -59,7 +59,6 @@ await describe('G02 - Heartbeat', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   // FR: G02.FR.01
index dae44e14f108a8dc516102f72334407954e911e5..c9662210f3e763fa06bad242325d2b6ae4486c73 100644 (file)
@@ -5,7 +5,7 @@
 /* cspell:ignore Bvbn NQIF CBCYX */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import { createTestableRequestService } from '../../../../src/charging-station/ocpp/2.0/__testable__/index.js'
 import {
@@ -62,7 +62,6 @@ await describe('M02 - Get15118EVCertificate Request', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await describe('EXI Install Action', async () => {
@@ -231,7 +230,6 @@ await describe('M03 - GetCertificateStatus Request', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await describe('OCSP Request Data', async () => {
@@ -350,7 +348,6 @@ await describe('Request Command Names', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await it('should send GET_15118_EV_CERTIFICATE command name', async () => {
index bd50afd571ea617ae79183f4ac8aa2109d824234..f9eea7adba79638bdb946ffc374f49fccc2535f3 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 
@@ -61,7 +61,6 @@ await describe('B07/B08 - NotifyReport', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   // FR: B07.FR.03, B07.FR.04
index 6fd5192cb10c540c86b99ba74ca3fc7007059cc3..ddd45116c9cc3d69825065994e93f30ac3929479 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 
@@ -48,7 +48,6 @@ await describe('I02 - SignCertificate Request', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await describe('CSR Generation', async () => {
index 00c618242c5298547be320d615d2958c0287fb2f..0084586d44483eb5e69eb16b7d42e077df588b33 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for OCPP 2.0 StatusNotification request building (G01)
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 
@@ -60,7 +60,6 @@ await describe('G01 - Status Notification', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   // FR: G01.FR.01
index 8f57ff78d6eff82521c0815d0bfb45e3a2bfffaf..ac717a9060a492b77331515fc1cec5552d1b7f82 100644 (file)
@@ -4,7 +4,7 @@
  */
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js'
 
@@ -51,7 +51,6 @@ await describe('OCPP Authentication', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await describe('OCPP 1.6 Authentication', async () => {
index 1b958188a756b3b53063c2e0669b7a71d41e2604..a5a586b8d3d769667d5560c5b6d25f9b4a3968ed 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for OCPP 1.6 authentication adapter
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../../src/charging-station/ChargingStation.js'
 import type { OCPP16AuthorizeResponse } from '../../../../../src/types/ocpp/1.6/Responses.js'
@@ -55,7 +55,6 @@ await describe('OCPP16AuthAdapter', async () => {
   })
 
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
 
index 28b8566d64244d9f723809668572eb1ed6e87038..cc6feba5998402a0b4b242dc1bd1cfe941b90942 100644 (file)
@@ -42,7 +42,6 @@ await describe('OCPP20AuthAdapter', async () => {
   })
 
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
 
index 470b952a75f1422776f86ec1bf8a2ce9f832ab01..9d79a94159899c6263f928737283363e1506836c 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for in-memory authorization cache conformance (G03.FR.01)
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { AuthorizationResult } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js'
 
@@ -43,7 +43,6 @@ await describe('InMemoryAuthCache - G03.FR.01 Conformance', async () => {
 
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await describe('G03.FR.01.001 - Cache Hit Behavior', async () => {
index 38562548c69afdac8fa47ab558299ba492118a86..6fef91142abc434695bf7c7aa2cec3315875f830 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for certificate-based authentication strategy
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../../src/charging-station/ChargingStation.js'
 import type { OCPPAuthAdapter } from '../../../../../src/charging-station/ocpp/auth/interfaces/OCPPAuthService.js'
@@ -58,7 +58,6 @@ await describe('CertificateAuthStrategy', async () => {
   })
 
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
 
index acdecb624091a077ef3aa9552b6c6c43ad96c167..8d891f5d097779cf06a807fdc3e5990726533f90 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for local authorization strategy (cache and local list)
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type {
   AuthCache,
@@ -40,7 +40,6 @@ await describe('LocalAuthStrategy', async () => {
   })
 
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
 
@@ -102,19 +101,6 @@ await describe('LocalAuthStrategy', async () => {
       await strategy.initialize(config)
     })
 
-    afterEach(() => {
-      // Reset mock properties to prevent state pollution between tests
-      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
-      delete (mockLocalAuthListManager as any).getEntry
-      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
-      delete (mockAuthCache as any).get
-      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
-      delete (mockAuthCache as any).set
-      // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
-      delete (mockAuthCache as any).remove
-      mock.restoreAll()
-    })
-
     await it('should authenticate using local auth list', async () => {
       mockLocalAuthListManager.getEntry = async () =>
         await Promise.resolve({
index 3727f3b454d08ae5f25d9699f499ca3afa8c2b70..d75964a4bcde3c2ddf106b754315872a7ebd5aa6 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for remote (CSMS) authorization strategy
  */
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type {
   AuthCache,
@@ -45,7 +45,6 @@ await describe('RemoteAuthStrategy', async () => {
   })
 
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
 
index 7d993f61f79fd42cc851eeaa571826f6935e3cf8..37aee6430f2134c230a7b6f7b44d0a43215766a4 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for authentication type definitions and mappings
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import {
   AuthContext,
@@ -34,7 +34,6 @@ import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 await describe('AuthTypes', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await describe('IdentifierTypeGuards', async () => {
     await it('should correctly identify OCPP 1.6 types', () => {
index c2a7f031739d6055d6ef1691755ca70602aaa33a..c88a894bdba777a8af727c0e88a35dc9d948f66c 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for authentication helper utilities
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import {
   AuthContext,
@@ -20,7 +20,6 @@ import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 await describe('AuthHelpers', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await describe('calculateTTL', async () => {
     await it('should return undefined for undefined expiry date', () => {
index ac6b6c40a7dc818eeadd5d5eb5f4e25c014b4566..5279ea41bbf9687c2732db5c41c93a87afd10f43 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for authentication validation utilities
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import {
   type AuthConfiguration,
@@ -18,7 +18,6 @@ import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 await describe('AuthValidators', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await describe('isValidCacheTTL', async () => {
     await it('should return true for undefined TTL', () => {
index d1a4c7396ed67c99ddddcab004d1f242b92b6e93..fb9d91fba91dd5a1a8048fd4b249d7d684a8b718 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright Jerome Benoit. 2021-2025. All Rights Reserved.
 
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import {
   type AuthConfiguration,
@@ -18,7 +18,6 @@ import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js'
 await describe('AuthConfigValidator', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await describe('validate', async () => {
     await it('should accept valid configuration', () => {
index 209e21f0fa722eaeaef7cb9e833e566a0fa41ccc..8a36beeda3ea3e7d83bb963e344275c56dfc0e3d 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright Jerome Benoit. 2024-2025. All Rights Reserved.
 
 import { expect } from '@std/expect'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 import { gunzipSync } from 'node:zlib'
 
 import type { UUIDv4 } from '../../../src/types/index.js'
@@ -55,7 +55,6 @@ await describe('UIHttpServer', async () => {
   })
 
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
 
@@ -196,7 +195,6 @@ await describe('UIHttpServer', async () => {
     })
 
     afterEach(() => {
-      mock.restoreAll()
       standardCleanup()
     })
 
index cd07d2380ff52d299c257e96ef1e79b1082b4dbe..e2db4beee7f38778eb75c9ed4199441181669389 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright Jerome Benoit. 2024-2025. All Rights Reserved.
 
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import {
   createBodySizeLimiter,
@@ -21,7 +21,6 @@ const RATE_WINDOW_EXPIRY_DELAY_MS = 110
 
 await describe('UIServerSecurity', async () => {
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
   await describe('IsValidCredential', async () => {
index 216237aaa528609622e8260094813729a0c1e924..950cd10564f466d4543ce18dbd87d79fad9706aa 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright Jerome Benoit. 2024-2025. All Rights Reserved.
 
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import type { UUIDv4 } from '../../../src/types/index.js'
 
@@ -22,7 +22,6 @@ import {
 
 await describe('UIWebSocketServer', async () => {
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
   await it('should delete response handler after successful send', () => {
index 15593330f47f65e31f7b015feb936de23b6f7f5f..238d5a1c5abb7bd2d23c663791cb831f685e35cc 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright Jerome Benoit. 2024-2025. All Rights Reserved.
 
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import { ProcedureName, ProtocolVersion, ResponseStatus } from '../../../../src/types/index.js'
 import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js'
@@ -19,7 +19,6 @@ import {
 
 await describe('AbstractUIService', async () => {
   afterEach(() => {
-    mock.restoreAll()
     standardCleanup()
   })
   await it('should check response handler existence before sending', () => {
index a4271d14c5588687664640d07060755d967ae193..f7d4fd49ea68279ce02c8d95dbc1caf36225b325 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for base error class functionality
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import { BaseError } from '../../src/exception/BaseError.js'
 import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
@@ -11,7 +11,6 @@ import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 await describe('BaseError', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await it('should create instance with default values', () => {
     const baseError = new BaseError()
index a1bb50f288655838c56b6e8d2d6452d3fd775e51..5c07bd9cde2acafaab59cd118e32fb00686dd87a 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for OCPP-specific error class
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import { OCPPError } from '../../src/exception/OCPPError.js'
 import { ErrorType } from '../../src/types/index.js'
@@ -13,7 +13,6 @@ import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 await describe('OCPPError', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await it('should create instance with error code and default values', () => {
index a12b970fdde5bd0660ca6955f14ae1f26f8bea6e..f0bed3ca9c2a7b1067956e0b628deff15dca92d3 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for configuration data types and enumerations
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import {
   ApplicationProtocolVersion,
@@ -15,7 +15,6 @@ import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 await describe('ConfigurationData', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
 
   await it('should define ConfigurationSection enumeration values', () => {
index 943216c5bb6b3e9e3e21ffbe573aff1f424e5e7b..cb5f39cf77fb0c1964ea3422c5bdaf016afeaafd 100644 (file)
@@ -4,7 +4,7 @@
  */
 import { expect } from '@std/expect'
 import { randomInt } from 'node:crypto'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import { AsyncLock, AsyncLockType } from '../../src/utils/AsyncLock.js'
 import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
@@ -12,7 +12,6 @@ import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 await describe('AsyncLock', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await it('should run synchronous functions exclusively in sequence', () => {
     const runs = 10
index 251206a5d670b7774d05c4f4581e653c2c3ef920..232b09c7d39797afccad654d5e1cf2f16240b3f9 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for electrical calculations (AC/DC power, amperage)
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import { ACElectricUtils, DCElectricUtils } from '../../src/utils/ElectricUtils.js'
 import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
@@ -11,7 +11,6 @@ import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 await describe('ElectricUtils', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await it('should calculate DC power from voltage and current', () => {
     expect(DCElectricUtils.power(230, 1)).toBe(230)
index 05bd6cc47f207c08fb23eae3c2a46433c21d8404..211524b64728a9a953323e585790ade1511836b6 100644 (file)
@@ -3,7 +3,7 @@
  * @description Unit tests for statistical calculation utilities
  */
 import { expect } from '@std/expect'
-import { afterEach, describe, it, mock } from 'node:test'
+import { afterEach, describe, it } from 'node:test'
 
 import { average, max, median, min, percentile, std } from '../../src/utils/StatisticUtils.js'
 import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
@@ -11,7 +11,6 @@ import { standardCleanup } from '../helpers/TestLifecycleHelpers.js'
 await describe('StatisticUtils', async () => {
   afterEach(() => {
     standardCleanup()
-    mock.restoreAll()
   })
   await it('should calculate arithmetic mean of array values', () => {
     expect(average([])).toBe(0)