Context
Parent: #160
JSON field naming inconsistency (#149) was missed because tests check individual fields exist but never validate that struct field names match the serialized JSON schema end-to-end. Report types have to_json() and to_terminal() methods but no tests verify the full output shape.
Expected Behavior
Tests that serialize reports to JSON, deserialize into serde_json::Value, and assert the complete field structure matches a spec. Optionally, snapshot tests (via insta) that catch any unintentional output changes.
Scope
- Add round-trip tests for every report type:
TraceReport, ChainReport, CutReport, DiffReport, PackagesReport
- Each test: build a report from a fixture, call
to_json(), parse the JSON, assert all field names and types
- Consider adding
insta for snapshot testing of both JSON and terminal output
- Assert field name consistency across report types (e.g., weight fields always use
_bytes suffix)
- Assert that
to_terminal() and to_json() contain equivalent information
Context
Parent: #160
JSON field naming inconsistency (#149) was missed because tests check individual fields exist but never validate that struct field names match the serialized JSON schema end-to-end. Report types have
to_json()andto_terminal()methods but no tests verify the full output shape.Expected Behavior
Tests that serialize reports to JSON, deserialize into
serde_json::Value, and assert the complete field structure matches a spec. Optionally, snapshot tests (viainsta) that catch any unintentional output changes.Scope
TraceReport,ChainReport,CutReport,DiffReport,PackagesReportto_json(), parse the JSON, assert all field names and typesinstafor snapshot testing of both JSON and terminal output_bytessuffix)to_terminal()andto_json()contain equivalent information