()
| 884 | |
| 885 | #[tokio::test] |
| 886 | async fn test_cancel_confirmation() { |
| 887 | let (event_tx, _) = broadcast::channel(100); |
| 888 | let manager = ConfirmationManager::new(ConfirmationPolicy::enabled(), event_tx); |
| 889 | |
| 890 | // Request confirmation |
| 891 | let rx = manager |
| 892 | .request_confirmation("tool-1", "bash", &serde_json::json!({})) |
| 893 | .await; |
| 894 | |
| 895 | assert_eq!(manager.pending_count().await, 1); |
| 896 | |
| 897 | // Cancel confirmation |
| 898 | let cancelled = manager.cancel("tool-1").await; |
| 899 | assert!(cancelled); |
| 900 | assert_eq!(manager.pending_count().await, 0); |
| 901 | |
| 902 | // Check response indicates cancellation |
| 903 | let response = rx.await.unwrap(); |
| 904 | assert!(!response.approved); |
| 905 | assert_eq!(response.reason, Some("Confirmation cancelled".to_string())); |
| 906 | } |
| 907 | |
| 908 | #[tokio::test] |
| 909 | async fn test_cancel_nonexistent() { |
nothing calls this directly
no test coverage detected