// use chrono::Utc;
// use chrono_tz::US::Eastern;

use crate::ncaa::query;
use crate::ncaa::{
    scoreboard::Scoreboard,
    sports,
};

#[tokio::test]
async fn test_query_scoreboard() -> Result<(), reqwest::Error>  {

    let sports = sports::supported_sports();
    let mut response: Scoreboard;

    for sport in &sports {
        if let Some(variations) = &sport.variations {
            for variation in variations {
                for division in &sport.divisions {
                    response = query::scoreboard(
                        &format!("{}{}",&sport.name, &variation),
                        &division,
                        &sport.season_start).await?;
                    assert_eq!(response.input_md5.is_empty(), false);
                }
            }
        }
    }

    Ok(())
}

// TODO: fix test and re-enable
// #[tokio::test]
// async fn test_query_scoreboards_between() -> Result<(), reqwest::Error>  {
//     let sports = sports::supported_sports();
//     let mut response = Vec::<Scoreboard>::new();
// 
//     for sport in &sports {
//         for variation in &sport.variations {
//             for division in &sport.divisions {
//                 if let Some(todays_date_str) = sport.get_date_str(Utc::now().with_timezone(&Eastern)) {
//                     println!("todays date str: {}", todays_date_str);
//                 }
//                 response = query::scoreboards_between(
//                     &format!("{}{}",&sport.name, &variation),
//                     &division,
//                     &sport.date_format,
//                     &sport.season_start,
//                     &sport.season_end).await?;
//                 println!("scoreboards found: {}", response.len());
//                 assert!(response.len() > 1);  // should be much higher than 1
//             }
//         }
//     }
// 
//     Ok(())
// }