From: Jérôme Benoit Date: Fri, 27 Feb 2026 19:17:11 +0000 (+0100) Subject: fix(tests): add afterEach cleanup to RemoteStartAuth test X-Git-Tag: v3~111 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=024e8b4e109f64c0b4aa7c01cfdc31c29970fab8;p=e-mobility-charging-stations-simulator.git fix(tests): add afterEach cleanup to RemoteStartAuth test - Added afterEach hook to clear mock references - Prevents test pollution between test cases - Only 1 file was missing cleanup (not 33 as initially audited) - All 280 tests passing --- diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts index bc82ba99..5d4b9e5e 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts @@ -7,7 +7,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { expect } from '@std/expect' -import { beforeEach, describe, it } from 'node:test' +import { afterEach, beforeEach, describe, it } from 'node:test' import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js' import type { ConnectorStatus } from '../../../../src/types/ConnectorStatus.js' @@ -62,6 +62,12 @@ await describe('OCPP20IncomingRequestService - G03.FR.03 Remote Start Pre-Author service = new OCPP20IncomingRequestService() }) + afterEach(() => { + // Reset service and mock charging station state + mockChargingStation = undefined as any + service = undefined as any + }) + await describe('G03.FR.03.001 - Successful remote start with valid token', async () => { await it('should create valid request with authorized idToken', () => { // Given: Valid idToken that will be authorized