use crate::ncaa::query;
use crate::ncaa::basketball;

use super::common::TEST_GAME_IDS;

#[tokio::test]
async fn test_query_boxscore() -> Result<(), reqwest::Error>  {
    let mut response: basketball::boxscore::Boxscore;

    for id in &TEST_GAME_IDS {
        response = query::boxscore(&id).await?;
        assert_eq!(response.meta.title.is_empty(), false);
        assert_eq!(response.meta.division.unwrap(), "d1".to_string());
        assert_eq!(response.meta.teams.len(), 2);

        let teams = response.teams.unwrap();
        assert_eq!(teams.len(), 2);
        assert_eq!(teams[0].player_header.position, "POS".to_string());
        assert_eq!(teams[0].player_header.minutes_played, "MIN".to_string());
        assert_eq!(teams[0].player_header.assists, "AST".to_string());
        assert_eq!(teams[0].player_header.points, "PTS".to_string());
    };
    Ok(())
}
