Repository navigation
test(verify): cover adapter robustness against transport failures - #4
Merged
Merged
Conversation
Adds unit tests proving SolplanetCgiAdapter.read() NEVER rejects and always resolves to an offline InverterState when the CGI transport fails. Covers the spec scenarios in inverter-adapter-interface.md and solplanet-cgi-adapter.md that were previously asserted only by static inspection. The tests use nock (already a devDependency, but never imported) to intercept the HTTP socket. A real axios instance is injected via a thin HttpService stub so nock actually sees the request. Test breakdown: - HTTP 502, 404 -> offline state, identity preserved - JSON parse error -> offline state - Connection refused -> offline state - Adapter timeout -> offline state (rxjs timeout fires) - Non-numeric fields -> coerced to 0; STATE='FAULT' -> St=7 - E-Total vs WH -> E-Total wins when both present - toFiniteNumber + mapOperatingState helpers (table-driven)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds unit tests proving SolplanetCgiAdapter.read() NEVER rejects and always resolves to an offline InverterState when the CGI transport fails (4xx, 5xx, timeout, JSON parse error, non-numeric fields).
Covers the spec scenarios in inverter-adapter-interface.md and solplanet-cgi-adapter.md that were previously asserted only by static inspection. Uses nock (already a devDependency) to intercept the HTTP socket.
This PR exists to exercise CI on the verify/ branch — it will be merged to main if all checks pass, then the orchestrator proceeds to sdd-archive.