use athena_rs::drivers::postgresql::column_resolver::find_matching_column;

#[test]
fn test_find_matching_column_exact() {
    let columns = vec![
        "id".to_string(),
        "username".to_string(),
        "email".to_string(),
    ];
    assert_eq!(
        find_matching_column("username", &columns),
        Some("username".to_string())
    );
}

#[test]
fn test_find_matching_column_case_insensitive() {
    let columns = vec![
        "id".to_string(),
        "userName".to_string(),
        "email".to_string(),
    ];
    assert_eq!(
        find_matching_column("username", &columns),
        Some("userName".to_string())
    );
}

#[test]
fn test_find_matching_column_fuzzy() {
    let columns = vec![
        "id".to_string(),
        "username".to_string(),
        "display_name".to_string(),
        "email".to_string(),
    ];
    assert_eq!(
        find_matching_column("display_username", &columns),
        Some("display_name".to_string())
    );
}

#[test]
fn test_find_matching_column_no_match() {
    let columns = vec![
        "id".to_string(),
        "username".to_string(),
        "email".to_string(),
    ];
    assert_eq!(find_matching_column("nonexistent", &columns), None);
}
