Webwright
Webwright copied to clipboard
test: add unit tests for parse_json_output
Problem
parse_json_output in base.py is called on every agent step but has no test coverage. The done-demotion logic (demoting done=true to false when there is a non-empty action) is a subtle invariant that is easy to break silently.
Fix
Add tests/unit/test_parse_json_output.py with tests covering: valid JSON roundtrip, done demotion when action is non-empty, done preserved when action is empty, non-dict JSON raises ValueError, malformed JSON raises ValueError, and custom action_field.
Changes
tests/unit/test_parse_json_output.py— new test file, 6 test cases
Not affected
parse_json_outputimplementation — not changed- All other source files — not touched