use std::time::Duration;
use tokio::time::timeout;
#[tokio::test]
async fn test_websocket_server_creation() {
let _server = things3_cli::websocket::WebSocketServer::new(8081);
}
#[tokio::test]
async fn test_progress_tracking_integration() {
use tempfile::NamedTempFile;
let temp_file = NamedTempFile::new().unwrap();
let db_path = temp_file.path();
things3_core::test_utils::create_test_database(db_path)
.await
.unwrap();
let db = things3_core::ThingsDatabase::new(db_path).await.unwrap();
let manager = things3_cli::bulk_operations::BulkOperationsManager::new();
let progress_result = timeout(
Duration::from_secs(10),
manager.export_all_tasks(&db, "json"),
)
.await;
assert!(
progress_result.is_ok(),
"Bulk operations should complete with progress tracking"
);
}
#[tokio::test]
async fn test_event_broadcasting_integration() {
let broadcaster = things3_cli::events::EventBroadcaster::new();
let mut receiver = broadcaster.subscribe_all();
let event = things3_cli::events::Event {
id: uuid::Uuid::new_v4(),
event_type: things3_cli::events::EventType::TaskCreated {
task_id: uuid::Uuid::new_v4(),
},
timestamp: chrono::Utc::now(),
data: None,
source: "integration_test".to_string(),
};
let broadcast_result = timeout(Duration::from_secs(2), broadcaster.broadcast(event)).await;
assert!(
broadcast_result.is_ok(),
"Event broadcasting should complete"
);
let receive_result = timeout(Duration::from_secs(2), receiver.recv()).await;
assert!(receive_result.is_ok(), "Event reception should complete");
}