From f3b4cd52bc64c33d61ac99566328c85e616e8e60 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 28 Feb 2026 23:18:51 +0100 Subject: [PATCH] test: add standardCleanup() and fix import ordering in test files --- tests/charging-station/ConfigurationKeyUtils.test.ts | 4 +++- tests/charging-station/Helpers.test.ts | 2 +- .../OCPP20IncomingRequestService-CertificateSigned.test.ts | 2 ++ .../ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts | 2 ++ .../OCPP20IncomingRequestService-DeleteCertificate.test.ts | 2 ++ ...0IncomingRequestService-GetInstalledCertificateIds.test.ts | 2 ++ .../OCPP20IncomingRequestService-InstallCertificate.test.ts | 2 ++ .../ocpp/2.0/OCPP20RequestService-BootNotification.test.ts | 2 ++ .../ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts | 2 ++ .../ocpp/2.0/OCPP20RequestService-ISO15118.test.ts | 2 ++ .../ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts | 2 ++ .../ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts | 2 ++ .../ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts | 2 ++ tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts | 2 +- tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts | 2 ++ .../ocpp/auth/adapters/OCPP16AuthAdapter.test.ts | 2 ++ .../ocpp/auth/adapters/OCPP20AuthAdapter.test.ts | 2 ++ .../ocpp/auth/cache/InMemoryAuthCache.test.ts | 2 ++ .../ocpp/auth/strategies/CertificateAuthStrategy.test.ts | 2 ++ .../ocpp/auth/strategies/LocalAuthStrategy.test.ts | 2 ++ .../ocpp/auth/strategies/RemoteAuthStrategy.test.ts | 2 ++ tests/charging-station/ocpp/auth/types/AuthTypes.test.ts | 2 ++ tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts | 2 ++ tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts | 2 ++ .../charging-station/ocpp/auth/utils/ConfigValidator.test.ts | 2 ++ tests/charging-station/ui-server/UIHttpServer.test.ts | 4 +++- tests/charging-station/ui-server/UIServerSecurity.test.ts | 4 +++- tests/charging-station/ui-server/UIWebSocketServer.test.ts | 4 +++- .../ui-server/ui-services/AbstractUIService.test.ts | 4 +++- tests/exception/BaseError.test.ts | 4 +++- tests/exception/OCPPError.test.ts | 4 +++- tests/types/ConfigurationData.test.ts | 4 +++- tests/utils/AsyncLock.test.ts | 4 +++- tests/utils/ConfigurationUtils.test.ts | 2 +- tests/utils/ElectricUtils.test.ts | 4 +++- tests/utils/ErrorUtils.test.ts | 2 +- tests/utils/StatisticUtils.test.ts | 4 +++- tests/utils/Utils.test.ts | 2 +- tests/worker/WorkerUtils.test.ts | 2 +- 39 files changed, 83 insertions(+), 17 deletions(-) diff --git a/tests/charging-station/ConfigurationKeyUtils.test.ts b/tests/charging-station/ConfigurationKeyUtils.test.ts index e517e3b7..f0b6191a 100644 --- a/tests/charging-station/ConfigurationKeyUtils.test.ts +++ b/tests/charging-station/ConfigurationKeyUtils.test.ts @@ -14,6 +14,7 @@ import { setConfigurationKeyValue, } from '../../src/charging-station/ConfigurationKeyUtils.js' import { logger } from '../../src/utils/Logger.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' import { createMockChargingStation } from './ChargingStationTestUtils.js' const TEST_KEY_1 = 'TestKey1' @@ -21,8 +22,9 @@ const MIXED_CASE_KEY = 'MiXeDkEy' const VALUE_A = 'ValueA' const VALUE_B = 'ValueB' -await describe('ConfigurationKeyUtils test suite', async () => { +await describe('ConfigurationKeyUtils', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await describe('getConfigurationKey()', async () => { diff --git a/tests/charging-station/Helpers.test.ts b/tests/charging-station/Helpers.test.ts index 3c8f32b1..8e9cd75f 100644 --- a/tests/charging-station/Helpers.test.ts +++ b/tests/charging-station/Helpers.test.ts @@ -39,7 +39,7 @@ import { createMockChargingStationTemplate, } from './ChargingStationTestUtils.js' -await describe('Helpers test suite', async () => { +await describe('Helpers', async () => { const baseName = 'CS-TEST' const chargingStationTemplate = createMockChargingStationTemplate(baseName) diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts index 1859e14e..dc884220 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts @@ -18,6 +18,7 @@ import { OCPPVersion, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' import { createMockCertificateManager } from './OCPP20TestUtils.js' @@ -83,6 +84,7 @@ await describe('I04 - CertificateSigned', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) await describe('Valid Certificate Chain Installation', async () => { diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts index 54256f88..df3c9a01 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts @@ -13,11 +13,13 @@ import { OCPP20IncomingRequestService } from '../../../../src/charging-station/o import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js' import { GenericStatus, OCPPVersion } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' await describe('C11 - Clear Authorization Data in Authorization Cache', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts index b08c11cd..9a9f496e 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts @@ -20,6 +20,7 @@ import { ReasonCodeEnumType, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' import { @@ -43,6 +44,7 @@ const NONEXISTENT_CERTIFICATE_HASH_DATA = { await describe('I04 - DeleteCertificate', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts index 7a53ea5a..98178b23 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts @@ -22,6 +22,7 @@ import { OCPPVersion, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' import { @@ -74,6 +75,7 @@ await describe('I04 - GetInstalledCertificateIds', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts index a364726a..750d095f 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts @@ -19,6 +19,7 @@ import { OCPPVersion, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' import { @@ -53,6 +54,7 @@ SIb3DQEBCwUAA0EAexpired== await describe('I03 - InstallCertificate', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts index 749406b9..456381c1 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts @@ -17,6 +17,7 @@ import { } from '../../../../src/types/index.js' import { type ChargingStationType } from '../../../../src/types/ocpp/2.0/Common.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGE_POINT_MODEL, TEST_CHARGE_POINT_SERIAL_NUMBER, @@ -59,6 +60,7 @@ await describe('B01 - Cold Boot Charging Station', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts index 3bcf5192..00b1c0e1 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-HeartBeat.test.ts @@ -15,6 +15,7 @@ import { OCPPVersion, } from '../../../../src/types/index.js' import { Constants, has } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGE_POINT_MODEL, TEST_CHARGE_POINT_SERIAL_NUMBER, @@ -57,6 +58,7 @@ await describe('G02 - Heartbeat', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts index f4bad7ba..00c39026 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts @@ -23,6 +23,7 @@ import { ReasonCodeEnumType, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' @@ -60,6 +61,7 @@ await describe('M02 - Get15118EVCertificate Request', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts index bfb9e02c..bd50afd5 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts @@ -24,6 +24,7 @@ import { type ReportDataType, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGE_POINT_MODEL, TEST_CHARGE_POINT_SERIAL_NUMBER, @@ -59,6 +60,7 @@ await describe('B07/B08 - NotifyReport', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts index 7ac34e19..6fd5192c 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts @@ -18,6 +18,7 @@ import { OCPPVersion, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' @@ -46,6 +47,7 @@ await describe('I02 - SignCertificate Request', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts index 3b31c6ca..00c61824 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-StatusNotification.test.ts @@ -16,6 +16,7 @@ import { OCPPVersion, } from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_FIRMWARE_VERSION, TEST_STATUS_CHARGE_POINT_MODEL, @@ -58,6 +59,7 @@ await describe('G01 - Status Notification', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts b/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts index 930c2b9d..94001aa9 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts @@ -64,7 +64,7 @@ function buildWsExampleUrl (targetLength: number, fillerChar = 'a'): string { return base + fillerChar.repeat(targetLength - base.length) } -await describe('B05/B06 - OCPP20VariableManager test suite', async () => { +await describe('B05 - OCPP20VariableManager', async () => { // Type declaration for mock ChargingStation let station: ChargingStation diff --git a/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts b/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts index d76170d0..84999597 100644 --- a/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts +++ b/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts @@ -15,6 +15,7 @@ import { IdentifierType, } from '../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { OCPPVersion } from '../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' import { createMockAuthRequest, createMockIdentifier } from './helpers/MockFactories.js' @@ -49,6 +50,7 @@ await describe('OCPP Authentication Integration Tests', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts b/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts index 04b6a08f..1b958188 100644 --- a/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts +++ b/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts @@ -18,6 +18,7 @@ import { } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { OCPP16AuthorizationStatus } from '../../../../../src/types/ocpp/1.6/Transaction.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult, createMockIdentifier } from '../helpers/MockFactories.js' await describe('OCPP16AuthAdapter', async () => { @@ -55,6 +56,7 @@ await describe('OCPP16AuthAdapter', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await describe('constructor', async () => { diff --git a/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts b/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts index 4cd34754..0dfb917d 100644 --- a/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts +++ b/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts @@ -22,6 +22,7 @@ import { RequestStartStopStatusEnumType, } from '../../../../../src/types/ocpp/2.0/Transaction.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult, createMockIdentifier } from '../helpers/MockFactories.js' await describe('OCPP20AuthAdapter', async () => { @@ -42,6 +43,7 @@ await describe('OCPP20AuthAdapter', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await describe('constructor', async () => { diff --git a/tests/charging-station/ocpp/auth/cache/InMemoryAuthCache.test.ts b/tests/charging-station/ocpp/auth/cache/InMemoryAuthCache.test.ts index f6a2cf7e..470b952a 100644 --- a/tests/charging-station/ocpp/auth/cache/InMemoryAuthCache.test.ts +++ b/tests/charging-station/ocpp/auth/cache/InMemoryAuthCache.test.ts @@ -12,6 +12,7 @@ import { AuthenticationMethod, AuthorizationStatus, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult } from '../helpers/MockFactories.js' /** @@ -41,6 +42,7 @@ await describe('InMemoryAuthCache - G03.FR.01 Conformance', async () => { }) afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts b/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts index 195ebf8b..38562548 100644 --- a/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts @@ -15,6 +15,7 @@ import { IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult, createMockAuthRequest, @@ -58,6 +59,7 @@ await describe('CertificateAuthStrategy', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await describe('constructor', async () => { diff --git a/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts b/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts index 5978dd94..f34eb837 100644 --- a/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts @@ -18,6 +18,7 @@ import { IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthCache, createMockAuthorizationResult, @@ -40,6 +41,7 @@ await describe('LocalAuthStrategy', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await describe('constructor', async () => { diff --git a/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts b/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts index 973b46a1..3727f3b4 100644 --- a/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts @@ -17,6 +17,7 @@ import { IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthCache, createMockAuthRequest, @@ -45,6 +46,7 @@ await describe('RemoteAuthStrategy', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await describe('constructor', async () => { diff --git a/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts b/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts index 0f84170c..7d993f61 100644 --- a/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts +++ b/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts @@ -29,9 +29,11 @@ import { RequestStartStopStatusEnumType, } from '../../../../../src/types/ocpp/2.0/Transaction.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthTypes', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await describe('IdentifierTypeGuards', async () => { diff --git a/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts b/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts index db13cf29..c2a7f031 100644 --- a/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts +++ b/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts @@ -15,9 +15,11 @@ import { } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthHelpers } from '../../../../../src/charging-station/ocpp/auth/utils/AuthHelpers.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthHelpers', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await describe('calculateTTL', async () => { diff --git a/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts b/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts index 5060b8f2..ac6b6c40 100644 --- a/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts +++ b/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts @@ -13,9 +13,11 @@ import { } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthValidators } from '../../../../../src/charging-station/ocpp/auth/utils/AuthValidators.js' import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthValidators', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await describe('isValidCacheTTL', async () => { diff --git a/tests/charging-station/ocpp/auth/utils/ConfigValidator.test.ts b/tests/charging-station/ocpp/auth/utils/ConfigValidator.test.ts index a9c7b3ce..d1a4c739 100644 --- a/tests/charging-station/ocpp/auth/utils/ConfigValidator.test.ts +++ b/tests/charging-station/ocpp/auth/utils/ConfigValidator.test.ts @@ -13,9 +13,11 @@ import { AuthorizationStatus, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthConfigValidator } from '../../../../../src/charging-station/ocpp/auth/utils/ConfigValidator.js' +import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthConfigValidator', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await describe('validate', async () => { diff --git a/tests/charging-station/ui-server/UIHttpServer.test.ts b/tests/charging-station/ui-server/UIHttpServer.test.ts index 09207689..9e81b9e2 100644 --- a/tests/charging-station/ui-server/UIHttpServer.test.ts +++ b/tests/charging-station/ui-server/UIHttpServer.test.ts @@ -13,6 +13,7 @@ import type { UUIDv4 } from '../../../src/types/index.js' import { UIHttpServer } from '../../../src/charging-station/ui-server/UIHttpServer.js' import { DEFAULT_COMPRESSION_THRESHOLD } from '../../../src/charging-station/ui-server/UIServerSecurity.js' import { ApplicationProtocol, ResponseStatus } from '../../../src/types/index.js' +import { standardCleanup } from '../../helpers/TestLifecycleHelpers.js' import { GZIP_STREAM_FLUSH_DELAY_MS, TEST_UUID } from './UIServerTestConstants.js' import { createMockUIServerConfiguration, @@ -46,9 +47,10 @@ const createLargePayload = (status: ResponseStatus = ResponseStatus.SUCCESS) => status, }) -await describe('UIHttpServer test suite', async () => { +await describe('UIHttpServer', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await it('should delete response handler after successful send', () => { const server = new TestableUIHttpServer(createHttpServerConfig()) diff --git a/tests/charging-station/ui-server/UIServerSecurity.test.ts b/tests/charging-station/ui-server/UIServerSecurity.test.ts index 5312bd94..ba1a062e 100644 --- a/tests/charging-station/ui-server/UIServerSecurity.test.ts +++ b/tests/charging-station/ui-server/UIServerSecurity.test.ts @@ -14,13 +14,15 @@ import { isValidCredential, isValidNumberOfStations, } from '../../../src/charging-station/ui-server/UIServerSecurity.js' +import { standardCleanup } from '../../helpers/TestLifecycleHelpers.js' import { waitForStreamFlush } from './UIServerTestUtils.js' const RATE_WINDOW_EXPIRY_DELAY_MS = 110 -await describe('UIServerSecurity test suite', async () => { +await describe('UIServerSecurity', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await describe('isValidCredential()', async () => { await it('should return true for matching credentials', () => { diff --git a/tests/charging-station/ui-server/UIWebSocketServer.test.ts b/tests/charging-station/ui-server/UIWebSocketServer.test.ts index a0afa68d..216237aa 100644 --- a/tests/charging-station/ui-server/UIWebSocketServer.test.ts +++ b/tests/charging-station/ui-server/UIWebSocketServer.test.ts @@ -10,6 +10,7 @@ import { afterEach, describe, it, mock } from 'node:test' import type { UUIDv4 } from '../../../src/types/index.js' import { ProcedureName, ResponseStatus } from '../../../src/types/index.js' +import { standardCleanup } from '../../helpers/TestLifecycleHelpers.js' import { TEST_UUID } from './UIServerTestConstants.js' import { createMockUIServerConfiguration, @@ -19,9 +20,10 @@ import { TestableUIWebSocketServer, } from './UIServerTestUtils.js' -await describe('UIWebSocketServer test suite', async () => { +await describe('UIWebSocketServer', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await it('should delete response handler after successful send', () => { const config = createMockUIServerConfiguration() diff --git a/tests/charging-station/ui-server/ui-services/AbstractUIService.test.ts b/tests/charging-station/ui-server/ui-services/AbstractUIService.test.ts index 5531054b..15593330 100644 --- a/tests/charging-station/ui-server/ui-services/AbstractUIService.test.ts +++ b/tests/charging-station/ui-server/ui-services/AbstractUIService.test.ts @@ -8,6 +8,7 @@ import { expect } from '@std/expect' import { afterEach, describe, it, mock } from 'node:test' import { ProcedureName, ProtocolVersion, ResponseStatus } from '../../../../src/types/index.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_HASH_ID, TEST_UUID } from '../UIServerTestConstants.js' import { createMockChargingStationData, @@ -16,9 +17,10 @@ import { TestableUIWebSocketServer, } from '../UIServerTestUtils.js' -await describe('AbstractUIService test suite', async () => { +await describe('AbstractUIService', async () => { afterEach(() => { mock.restoreAll() + standardCleanup() }) await it('should check response handler existence before sending', () => { const config = createMockUIServerConfiguration() diff --git a/tests/exception/BaseError.test.ts b/tests/exception/BaseError.test.ts index a715a7dd..a4271d14 100644 --- a/tests/exception/BaseError.test.ts +++ b/tests/exception/BaseError.test.ts @@ -6,9 +6,11 @@ import { expect } from '@std/expect' import { afterEach, describe, it, mock } from 'node:test' import { BaseError } from '../../src/exception/BaseError.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('BaseError test suite', async () => { +await describe('BaseError', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await it('should create instance with default values', () => { diff --git a/tests/exception/OCPPError.test.ts b/tests/exception/OCPPError.test.ts index 4a5ff487..a1bb50f2 100644 --- a/tests/exception/OCPPError.test.ts +++ b/tests/exception/OCPPError.test.ts @@ -8,9 +8,11 @@ import { afterEach, describe, it, mock } from 'node:test' import { OCPPError } from '../../src/exception/OCPPError.js' import { ErrorType } from '../../src/types/index.js' import { Constants } from '../../src/utils/Constants.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('OCPPError test suite', async () => { +await describe('OCPPError', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/types/ConfigurationData.test.ts b/tests/types/ConfigurationData.test.ts index 979d707c..a12b970f 100644 --- a/tests/types/ConfigurationData.test.ts +++ b/tests/types/ConfigurationData.test.ts @@ -10,9 +10,11 @@ import { ConfigurationSection, SupervisionUrlDistribution, } from '../../src/types/ConfigurationData.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('ConfigurationData test suite', async () => { +await describe('ConfigurationData', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) diff --git a/tests/utils/AsyncLock.test.ts b/tests/utils/AsyncLock.test.ts index 0d812577..943216c5 100644 --- a/tests/utils/AsyncLock.test.ts +++ b/tests/utils/AsyncLock.test.ts @@ -7,9 +7,11 @@ import { randomInt } from 'node:crypto' import { afterEach, describe, it, mock } from 'node:test' import { AsyncLock, AsyncLockType } from '../../src/utils/AsyncLock.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('AsyncLock test suite', async () => { +await describe('AsyncLock', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await it('should run synchronous functions exclusively in sequence', () => { diff --git a/tests/utils/ConfigurationUtils.test.ts b/tests/utils/ConfigurationUtils.test.ts index 57529008..61d19314 100644 --- a/tests/utils/ConfigurationUtils.test.ts +++ b/tests/utils/ConfigurationUtils.test.ts @@ -15,7 +15,7 @@ import { } from '../../src/utils/ConfigurationUtils.js' import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('ConfigurationUtils test suite', async () => { +await describe('ConfigurationUtils', async () => { afterEach(() => { standardCleanup() }) diff --git a/tests/utils/ElectricUtils.test.ts b/tests/utils/ElectricUtils.test.ts index 11940222..251206a5 100644 --- a/tests/utils/ElectricUtils.test.ts +++ b/tests/utils/ElectricUtils.test.ts @@ -6,9 +6,11 @@ import { expect } from '@std/expect' import { afterEach, describe, it, mock } from 'node:test' import { ACElectricUtils, DCElectricUtils } from '../../src/utils/ElectricUtils.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('ElectricUtils test suite', async () => { +await describe('ElectricUtils', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await it('should calculate DC power from voltage and current', () => { diff --git a/tests/utils/ErrorUtils.test.ts b/tests/utils/ErrorUtils.test.ts index cb4d6e62..c508107b 100644 --- a/tests/utils/ErrorUtils.test.ts +++ b/tests/utils/ErrorUtils.test.ts @@ -21,7 +21,7 @@ import { logger } from '../../src/utils/Logger.js' import { createMockChargingStation } from '../charging-station/ChargingStationTestUtils.js' import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('ErrorUtils test suite', async () => { +await describe('ErrorUtils', async () => { const { station: chargingStation } = createMockChargingStation({ baseName: 'CS-TEST' }) afterEach(() => { diff --git a/tests/utils/StatisticUtils.test.ts b/tests/utils/StatisticUtils.test.ts index 1b231a44..05bd6cc4 100644 --- a/tests/utils/StatisticUtils.test.ts +++ b/tests/utils/StatisticUtils.test.ts @@ -6,9 +6,11 @@ import { expect } from '@std/expect' import { afterEach, describe, it, mock } from 'node:test' import { average, max, median, min, percentile, std } from '../../src/utils/StatisticUtils.js' +import { standardCleanup } from '../helpers/TestLifecycleHelpers.js' -await describe('StatisticUtils test suite', async () => { +await describe('StatisticUtils', async () => { afterEach(() => { + standardCleanup() mock.restoreAll() }) await it('should calculate arithmetic mean of array values', () => { diff --git a/tests/utils/Utils.test.ts b/tests/utils/Utils.test.ts index 9f1c538c..57d5109a 100644 --- a/tests/utils/Utils.test.ts +++ b/tests/utils/Utils.test.ts @@ -45,7 +45,7 @@ import { } from '../../src/utils/Utils.js' import { standardCleanup, withMockTimers } from '../helpers/TestLifecycleHelpers.js' -await describe('Utils test suite', async () => { +await describe('Utils', async () => { afterEach(() => { standardCleanup() }) diff --git a/tests/worker/WorkerUtils.test.ts b/tests/worker/WorkerUtils.test.ts index a80f256f..942dc34c 100644 --- a/tests/worker/WorkerUtils.test.ts +++ b/tests/worker/WorkerUtils.test.ts @@ -15,7 +15,7 @@ import { } from '../../src/worker/WorkerUtils.js' import { standardCleanup, withMockTimers } from '../helpers/TestLifecycleHelpers.js' -await describe('WorkerUtils test suite', async () => { +await describe('WorkerUtils', async () => { afterEach(() => { standardCleanup() }) -- 2.43.0