From 67a5d3f9d2f1fe57b812db5cc318132f0e02950e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 29 Oct 2025 23:29:12 +0100 Subject: [PATCH] test(ocpp20): add read-only FileTransferProtocols regression test --- .../ocpp/2.0/OCPP20VariableManager.test.ts | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts b/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts index 034878c2..96afdaf2 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts @@ -1207,7 +1207,7 @@ await describe('OCPP20VariableManager test suite', async () => { variable: { name: OCPP20RequiredVariableName.TxStartPoint }, }, { - attributeValue: 'EVConnected,PowerPathClosed', // updated default + attributeValue: 'EVConnected,PowerPathClosed', component: { name: OCPP20ComponentName.TxCtrlr }, variable: { name: OCPP20RequiredVariableName.TxStopPoint }, }, @@ -1248,6 +1248,36 @@ await describe('OCPP20VariableManager test suite', async () => { expect(getRes.attributeValue).toBe('HTTPS,FTPS,SFTP') }) + await it('Should keep FileTransferProtocols value unchanged after rejected update attempt', () => { + const beforeCfg = getConfigurationKey( + mockChargingStation, + OCPP20RequiredVariableName.FileTransferProtocols as unknown as VariableType['name'] + ) + expect(beforeCfg?.value).toBe('HTTPS,FTPS,SFTP') + const rejected = manager.setVariables(mockChargingStation, [ + { + attributeValue: 'HTTP,HTTPS', + component: { name: OCPP20ComponentName.OCPPCommCtrlr }, + variable: { name: OCPP20RequiredVariableName.FileTransferProtocols }, + }, + ])[0] + expect(rejected.attributeStatus).toBe(SetVariableStatusEnumType.Rejected) + expect(rejected.attributeStatusInfo?.reasonCode).toBe(ReasonCodeEnumType.ReadOnly) + const afterGet = manager.getVariables(mockChargingStation, [ + { + component: { name: OCPP20ComponentName.OCPPCommCtrlr }, + variable: { name: OCPP20RequiredVariableName.FileTransferProtocols }, + }, + ])[0] + expect(afterGet.attributeStatus).toBe(GetVariableStatusEnumType.Accepted) + expect(afterGet.attributeValue).toBe('HTTPS,FTPS,SFTP') + const afterCfg = getConfigurationKey( + mockChargingStation, + OCPP20RequiredVariableName.FileTransferProtocols as unknown as VariableType['name'] + ) + expect(afterCfg?.value).toBe(beforeCfg?.value) + }) + await it('Should reject removed TimeSource members RTC and Manual', () => { const res = manager.setVariables(mockChargingStation, [ { -- 2.43.0