You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
parseRuntimeConfigJson() is the choke point every host config flows through, and it currently has zero coverage. It is also the place where the #6 validation gap and the #11 schema decisions live — writing these tests forces both.
Scope
On-device Unity tests under ESP32-Firmware/test/test_runtime_config/, run with pio test -e esp32_a over USB. On-device (not native) because RuntimeConfig uses Arduino String; native execution would need ArduinoFake or a std::string refactor, which is not worth it yet.
Test cases
Valid full config → accepted, every field populated in the struct
Garbage / truncated JSON → rejected, parse error in err
message_type != "config" → rejected
configured: false → rejected with "Device is not configured"
Missing topics.telemetry → currently passes validation, should fail — write it expecting failure, watch it fail, fix isValid(), watch it pass (this is the Fix RuntimeConfig validation for required topics #6 bug, test-first)
parseRole / roleToString round-trip for Primary, Standby, Unknown
Acceptance criteria
pio test -e esp32_a runs the suite on hardware and passes.
Context
parseRuntimeConfigJson()is the choke point every host config flows through, and it currently has zero coverage. It is also the place where the #6 validation gap and the #11 schema decisions live — writing these tests forces both.Scope
On-device Unity tests under
ESP32-Firmware/test/test_runtime_config/, run withpio test -e esp32_aover USB. On-device (not native) becauseRuntimeConfiguses ArduinoString; native execution would need ArduinoFake or astd::stringrefactor, which is not worth it yet.Test cases
errmessage_type!="config"→ rejectedconfigured: false→ rejected with "Device is not configured"enabled: false→ rejected — documents the current remote-disable dead end; this test's expectation flips when Fix RuntimeConfig validation for required topics #6 is fixedrack_id→ rejectedrole: "controllerA"→ rejected as Unknown — codifies the role-vocabulary decision from Align config schema between firmware and host provisioning example #11topics.telemetry→ currently passes validation, should fail — write it expecting failure, watch it fail, fixisValid(), watch it pass (this is the Fix RuntimeConfig validation for required topics #6 bug, test-first)parseRole/roleToStringround-trip for Primary, Standby, UnknownAcceptance criteria
pio test -e esp32_aruns the suite on hardware and passes.Relates to #6, #11.