From: Jérôme Benoit Date: Wed, 29 Oct 2025 22:29:12 +0000 (+0100) Subject: test(ocpp20): add read-only FileTransferProtocols regression test X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=67a5d3f9d2f1fe57b812db5cc318132f0e02950e;p=e-mobility-charging-stations-simulator.git test(ocpp20): add read-only FileTransferProtocols regression test --- 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, [ {