From c5d29bd77e02e63b0b8164dd40bfb219af51a098 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 3 Mar 2026 18:42:33 +0100 Subject: [PATCH] fix(tests): add missing @file headers and standardCleanup() Add mandatory @file JSDoc headers to 3 test files and standardCleanup() afterEach to 2 test files per TEST_STYLE_GUIDE.md sections 2 and 3. --- .../ocpp/2.0/OCPP20Integration-Certificate.test.ts | 5 +++++ .../ocpp/2.0/OCPP20Integration.test.ts | 5 +++++ .../ocpp/2.0/OCPP20SchemaValidation.test.ts | 8 +++++++- .../OCPP20ServiceUtils-enforceMessageLimits.test.ts | 12 +++++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/charging-station/ocpp/2.0/OCPP20Integration-Certificate.test.ts b/tests/charging-station/ocpp/2.0/OCPP20Integration-Certificate.test.ts index 00bded37..6e617381 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20Integration-Certificate.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20Integration-Certificate.test.ts @@ -1,3 +1,8 @@ +/** + * @file Tests for OCPP 2.0 certificate integration lifecycle + * @description Verifies certificate install, list, and delete operations end-to-end + */ + import { expect } from '@std/expect' import { afterEach, beforeEach, describe, it } from 'node:test' diff --git a/tests/charging-station/ocpp/2.0/OCPP20Integration.test.ts b/tests/charging-station/ocpp/2.0/OCPP20Integration.test.ts index 261e2359..949eb402 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20Integration.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20Integration.test.ts @@ -1,3 +1,8 @@ +/** + * @file Tests for OCPP 2.0 integration (SetVariables → GetVariables consistency) + * @description Verifies that SetVariables and GetVariables produce consistent results + */ + import { expect } from '@std/expect' import { afterEach, beforeEach, describe, it } from 'node:test' diff --git a/tests/charging-station/ocpp/2.0/OCPP20SchemaValidation.test.ts b/tests/charging-station/ocpp/2.0/OCPP20SchemaValidation.test.ts index 277cdb8e..35388ee8 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20SchemaValidation.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20SchemaValidation.test.ts @@ -14,9 +14,11 @@ import _Ajv, { type ValidateFunction } from 'ajv' import _ajvFormats from 'ajv-formats' import { readFileSync } from 'node:fs' import { join } from 'node:path' -import { describe, it } from 'node:test' +import { afterEach, describe, it } from 'node:test' import { fileURLToPath } from 'node:url' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' + const AjvConstructor = _Ajv.default const ajvFormats = _ajvFormats.default @@ -49,6 +51,10 @@ function makeValidator (schemaFile: string): ValidateFunction { } await describe('OCPP 2.0 schema validation — negative tests', async () => { + afterEach(() => { + standardCleanup() + }) + await it('AJV compiles ResetRequest schema without error (strict:false required)', () => { // Verifies the AJV configuration works for schemas using additionalItems pattern expect(() => makeValidator('ResetRequest.json')).not.toThrow() diff --git a/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-enforceMessageLimits.test.ts b/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-enforceMessageLimits.test.ts index 40851b64..ec5a2e3b 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-enforceMessageLimits.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-enforceMessageLimits.test.ts @@ -1,7 +1,13 @@ +/** + * @file Tests for OCPP20ServiceUtils.enforceMessageLimits + * @description Verifies message limit enforcement logic for OCPP 2.0 payloads + */ + import { expect } from '@std/expect' -import { describe, it } from 'node:test' +import { afterEach, describe, it } from 'node:test' import { OCPP20ServiceUtils } from '../../../../src/charging-station/ocpp/2.0/OCPP20ServiceUtils.js' +import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' interface MockLogger { debug: (...args: unknown[]) => void @@ -59,6 +65,10 @@ function makeRejectedBuilder () { } await describe('OCPP20ServiceUtils.enforceMessageLimits', async () => { + afterEach(() => { + standardCleanup() + }) + await describe('no limits configured (both 0)', async () => { await it('should return rejected:false and empty results when both limits are 0', () => { const station = makeMockStation() -- 2.43.0