()
| 1362 | |
| 1363 | #[tokio::test] |
| 1364 | async fn test_agent_with_context_provider() { |
| 1365 | let mock_client = Arc::new(MockLlmClient::new(vec![MockLlmClient::text_response( |
| 1366 | "Response using context", |
| 1367 | )])); |
| 1368 | |
| 1369 | let tool_executor = Arc::new(ToolExecutor::new("/tmp".to_string())); |
| 1370 | |
| 1371 | let provider = MockContextProvider::new("test-provider").with_items(vec![ContextItem::new( |
| 1372 | "ctx-1", |
| 1373 | ContextType::Resource, |
| 1374 | "Relevant context here", |
| 1375 | ) |
| 1376 | .with_source("test://docs/example")]); |
| 1377 | |
| 1378 | let config = AgentConfig { |
| 1379 | prompt_slots: SystemPromptSlots { |
| 1380 | extra: Some("You are helpful.".to_string()), |
| 1381 | ..Default::default() |
| 1382 | }, |
| 1383 | context_providers: vec![Arc::new(provider)], |
| 1384 | ..Default::default() |
| 1385 | }; |
| 1386 | |
| 1387 | let agent = AgentLoop::new( |
| 1388 | mock_client.clone(), |
| 1389 | tool_executor, |
| 1390 | test_tool_context(), |
| 1391 | config, |
| 1392 | ); |
| 1393 | let result = agent |
| 1394 | .execute(&[], "verify context provider output", None) |
| 1395 | .await |
| 1396 | .unwrap(); |
| 1397 | |
| 1398 | assert_eq!(result.text, "Response using context"); |
| 1399 | assert_eq!(mock_client.call_count.load(Ordering::SeqCst), 1); |
| 1400 | } |
| 1401 | |
| 1402 | #[tokio::test] |
| 1403 | async fn test_agent_context_provider_events() { |
nothing calls this directly
no test coverage detected