diff options
Diffstat (limited to 'src/api/schema/tests.rs')
| -rw-r--r-- | src/api/schema/tests.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/api/schema/tests.rs b/src/api/schema/tests.rs index bc044ee9..232c2b73 100644 --- a/src/api/schema/tests.rs +++ b/src/api/schema/tests.rs @@ -62,6 +62,41 @@ fn request_uses_dot_method_names() { } #[test] +fn agent_start_and_prompt_requests_round_trip() { + let start = Request { + id: "start".into(), + method: Method::AgentStart(AgentStartParams { + name: "reviewer".into(), + kind: "pi".into(), + pane_id: "w1:p2".into(), + args: vec!["--no-session".into()], + timeout_ms: Some(30_000), + }), + }; + let start_json = serde_json::to_value(&start).unwrap(); + assert_eq!(start_json["method"], "agent.start"); + assert_eq!(start_json["params"]["pane_id"], "w1:p2"); + assert_eq!( + serde_json::from_value::<Request>(start_json).unwrap(), + start + ); + + let prompt = Request { + id: "prompt".into(), + method: Method::AgentPrompt(AgentPromptParams { + target: "reviewer".into(), + text: "review this".into(), + }), + }; + let prompt_json = serde_json::to_value(&prompt).unwrap(); + assert_eq!(prompt_json["method"], "agent.prompt"); + assert_eq!( + serde_json::from_value::<Request>(prompt_json).unwrap(), + prompt + ); +} + +#[test] fn bundled_protocol_schema_refs_resolve_inside_bundle() { fn assert_no_standalone_refs(value: &serde_json::Value) { match value { |
