]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix(charging-station): throw BaseError on invalid supervision URL and revert state...
authorReginald Alfret V <reginaldalfret@gmail.com>
Wed, 7 Oct 2026 20:47:59 +0000 (02:17 +0530)
committerGitHub <noreply@github.com>
Wed, 7 Oct 2026 20:47:59 +0000 (22:47 +0200)
commitcb8a959d58b232a14bd0023d83aa5c95a17d28d1
tree860de58add3e524a5e388409090db5b1a2c9a086
parent8b5bda421565ae5daf7817d51e72f18e9a11e086
fix(charging-station): throw BaseError on invalid supervision URL and revert state on set failure (#2136)

* fix(charging-station): throw BaseError on invalid supervision URL and revert state on set failure

Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
* [autofix.ci] apply automated fixes

* fix(charging-station): guard every supervision URL parsing path

The invalid-supervision-URL fix only covered the stationInfo branch of
setSupervisionUrl and passed a cause option BaseError does not accept, so the
file did not typecheck. Route every URL construction through a single
parseSupervisionUrl helper that raises a BaseError naming the offending field,
covering the template/config path, the OCPP-configuration key branch and the
wsConnectionUrl getter, and add the regression tests the issue requires.

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* test(charging-station): cover every supervision URL guard and isolate the suite

The getter guard added by the previous commit had no test: reverting it left
the suite green. The three supervision URL tests also leaked a temp template
directory each, because a station built with the default persistence writes its
configuration after the synchronous afterEach ran cleanup.

Move them into a dedicated ChargingStation-SupervisionUrl suite with an async
teardown that drains the pending write, disable persistence on every station
they build, add the missing getter regression, drop two inert creation options
and pin the exact BaseError message and name.

Name the charging station in the diagnostic and report the configured base URL
instead of the derived one, so the error matches the issue acceptance criteria
and no longer quotes a value the operator never configured.

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* fix(charging-station): normalize supervision URL before persisting

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
* refactor: reuse test helpers and keep README user-focused

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
---------

Signed-off-by: reginaldalfret <reginaldalfret@gmail.com>
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jérôme Benoit <jerome.benoit@sap.com>
Co-authored-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
cspell.config.yaml
src/charging-station/ChargingStation.ts
tests/charging-station/ChargingStation-Configuration.test.ts
tests/charging-station/ChargingStation-SupervisionUrl.test.ts [new file with mode: 0644]
tests/charging-station/fixtures/supervisionUrlWorker.mjs [new file with mode: 0644]