diff --git a/src/integration_test.rs b/src/integration_test.rs index 5227490..f22090c 100644 --- a/src/integration_test.rs +++ b/src/integration_test.rs @@ -4276,6 +4276,42 @@ mod gitea_sdk_tests { assert!(!repos.is_empty(), "Should find sol repo by query"); } + #[tokio::test] + async fn test_list_org_repos() { + let Some(gitea) = dev_gitea().await else { eprintln!("Skipping: no Gitea+OpenBao"); return; }; + let repos = gitea.list_org_repos("sol", "studio", Some(50)).await.unwrap(); + assert!(!repos.is_empty(), "Studio org should have repos"); + } + + #[tokio::test] + async fn test_get_issue() { + let Some(gitea) = dev_gitea().await else { eprintln!("Skipping: no Gitea+OpenBao"); return; }; + let issue = gitea.get_issue("sol", "studio", "sol", 1).await.unwrap(); + assert_eq!(issue.number, 1); + assert!(issue.title.contains("Bootstrap")); + } + + #[tokio::test] + async fn test_list_notifications() { + let Some(gitea) = dev_gitea().await else { eprintln!("Skipping: no Gitea+OpenBao"); return; }; + // May be empty, just verify it doesn't error + let _ = gitea.list_notifications("sol").await.unwrap(); + } + + #[tokio::test] + async fn test_list_orgs() { + let Some(gitea) = dev_gitea().await else { eprintln!("Skipping: no Gitea+OpenBao"); return; }; + let orgs = gitea.list_orgs("sol", "sol").await.unwrap(); + assert!(orgs.iter().any(|o| o.username == "studio"), "Should list studio org"); + } + + #[tokio::test] + async fn test_get_org() { + let Some(gitea) = dev_gitea().await else { eprintln!("Skipping: no Gitea+OpenBao"); return; }; + let org = gitea.get_org("sol", "studio").await.unwrap(); + assert_eq!(org.username, "studio"); + } + #[tokio::test] async fn test_create_and_close_issue() { let Some(gitea) = dev_gitea().await else { eprintln!("Skipping: no Gitea+OpenBao"); return; }; @@ -5466,6 +5502,30 @@ mod research_extended_tests { assert_eq!(json["tool_calls_made"], 3); } + #[test] + fn test_research_empty_tasks() { + let parsed: serde_json::Value = serde_json::from_str(r#"{"tasks":[]}"#).unwrap(); + let tasks: Vec = serde_json::from_value( + parsed.get("tasks").cloned().unwrap_or(serde_json::json!([])), + ).unwrap(); + assert!(tasks.is_empty()); + } + + #[test] + fn test_research_multiple_tasks_parse() { + let json = serde_json::json!({ + "tasks": [ + {"focus": "auth", "instructions": "check auth flow"}, + {"focus": "db", "instructions": "review schema"}, + {"focus": "api", "instructions": "list endpoints"}, + ] + }); + let tasks: Vec = serde_json::from_value(json["tasks"].clone()).unwrap(); + assert_eq!(tasks.len(), 3); + assert_eq!(tasks[0].focus, "auth"); + assert_eq!(tasks[2].focus, "api"); + } + #[test] fn test_research_result_output_format() { let results = vec![