()
| 2410 | |
| 2411 | #[test] |
| 2412 | fn test_server_to_json_http() { |
| 2413 | let server = McpServerConfig { |
| 2414 | command: None, |
| 2415 | args: vec![], |
| 2416 | env: BTreeMap::new(), |
| 2417 | url: Some("https://api.example.com".to_string()), |
| 2418 | headers: BTreeMap::from([("Authorization".to_string(), "Bearer token".to_string())]), |
| 2419 | transport_type: None, |
| 2420 | disabled: false, |
| 2421 | }; |
| 2422 | |
| 2423 | let json = server_to_json(&server); |
| 2424 | |
| 2425 | assert_eq!( |
| 2426 | json.get("url").unwrap().as_str().unwrap(), |
| 2427 | "https://api.example.com" |
| 2428 | ); |
| 2429 | assert!(json.get("headers").unwrap().as_object().is_some()); |
| 2430 | // Empty fields should not be present |
| 2431 | assert!(json.get("command").is_none()); |
| 2432 | assert!(json.get("args").is_none()); |
| 2433 | } |
| 2434 | |
| 2435 | #[test] |
| 2436 | fn test_server_to_json_orders_env_and_headers() { |
nothing calls this directly
no test coverage detected