use athena_rs::drivers::supabase::client::{SupabaseConnectionInfo, extract_host_from_url};

#[test]
fn test_extract_host_from_url() {
    assert_eq!(
        extract_host_from_url("https://abc123.supabase.co"),
        "abc123.supabase.co"
    );
    assert_eq!(
        extract_host_from_url("https://abc123.supabase.co/rest/v1"),
        "abc123.supabase.co"
    );
    assert_eq!(
        extract_host_from_url("http://localhost:54321"),
        "localhost:54321"
    );
}

#[test]
fn test_connection_info_creation() {
    let info = SupabaseConnectionInfo::new(
        "https://test.supabase.co".to_string(),
        "test-key".to_string(),
    );
    assert_eq!(info.host, "test.supabase.co");
    assert_eq!(info.name, None);

    let info_with_name = SupabaseConnectionInfo::with_name(
        "https://test.supabase.co".to_string(),
        "test-key".to_string(),
        "test-client".to_string(),
    );
    assert_eq!(info_with_name.name, Some("test-client".to_string()));
}
