Riven/riven/tests/tests_tr.rs
2024-02-24 21:42:06 -08:00

35 lines
955 B
Rust

mod testutils;
use futures::future::join_all;
use riven::consts::*;
use riven::models::summoner_v4::Summoner;
use testutils::{riot_api, riven_test};
const ROUTE: PlatformRoute = PlatformRoute::TR1;
#[riven_test]
async fn league_summoner_bulk_test() -> Result<(), String> {
let p = riot_api()
.league_v4()
.get_challenger_league(ROUTE, QueueType::RANKED_SOLO_5x5);
let league_list = p.await.map_err(|e| e.to_string())?;
println!(
"{:?} Challenger {} entries.",
ROUTE,
league_list.entries.len()
);
let summoner_vec = join_all(league_list.entries.iter().take(50).map(|entry| {
riot_api()
.summoner_v4()
.get_by_summoner_id(ROUTE, &entry.summoner_id)
}))
.await;
for (i, s) in summoner_vec.into_iter().enumerate() {
let summoner: Summoner = s.map_err(|e| e.to_string())?;
println!("{}: {}", i + 1, summoner.name);
}
Ok(())
}