]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
test(utils): add exponentialDelay backoff algorithm tests
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 13:51:13 +0000 (14:51 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Feb 2026 14:00:21 +0000 (15:00 +0100)
commitec00906cc95779c5c51df39eb84210eb25d6d0d6
tree24284533507da9f090a583f3f35e4e774d95166f
parent60bf8d9306af169c6c48ff83676bc30fd6f0bfc5
test(utils): add exponentialDelay backoff algorithm tests

WebSocket Exponential Backoff Algorithm Tests (7 tests):
- Verify default parameters (2^n * 100ms + jitter)
- Verify custom delayFactor parameter
- Verify exponential growth pattern (each delay ~2x previous)
- Verify random jitter produces variation (not deterministic)
- Verify jitter is within 0-20% range per spec
- Verify edge cases (default retry, large retry, small factor)
- Verify WebSocket reconnection scenarios (retry 1, 5, 10)

Tests cover the exponentialDelay() utility function used by
ChargingStation.reconnect() when reconnectExponentialDelay is enabled.

All tests pass.
tests/utils/Utils.test.ts