| 733 | /// exists — and `to_string` is called with `expect` in the command. |
| 734 | #[test] |
| 735 | fn json_payload_serializes() { |
| 736 | let dir = temp_repo(); |
| 737 | let out = json_cmd().to_json(dir.path(), &AgentRegistry::with_defaults()); |
| 738 | let text = serde_json::to_string(&out).expect("serializes"); |
| 739 | |
| 740 | let parsed: serde_json::Value = serde_json::from_str(&text).unwrap(); |
| 741 | assert!(parsed["agents"].is_array()); |
| 742 | assert!(parsed["totals"]["sessions"].is_number()); |
| 743 | // Absent rather than null, so consumers can test for presence. |
| 744 | assert!(parsed.get("sessions_error").is_none()); |
| 745 | } |
| 746 | |
| 747 | #[test] |
| 748 | fn test_session_store_for_temp_repo() { |