mirror of https://github.com/MingweiSamuel/Riven
40 lines
1.0 KiB
Rust
40 lines
1.0 KiB
Rust
mod testutils;
|
|
use riven::consts::*;
|
|
use riven::models::summoner_v4::Summoner;
|
|
use testutils::riot_api;
|
|
|
|
const ROUTE: PlatformRoute = PlatformRoute::TR1;
|
|
|
|
#[tokio_shared_rt::test]
|
|
async fn league_summoner_bulk_test() -> Result<(), String> {
|
|
let p = riot_api()
|
|
.league_v4()
|
|
.get_challenger_league(ROUTE, QueueType::RANKED_SOLO_5x5);
|
|
// let p = future_start(p);
|
|
let ll = p.await.map_err(|e| e.to_string())?;
|
|
|
|
println!("{:?} Challenger {} entries.", ROUTE, ll.entries.len());
|
|
|
|
let sl = ll
|
|
.entries
|
|
.iter()
|
|
.take(50)
|
|
.map(|entry| {
|
|
riot_api()
|
|
.summoner_v4()
|
|
.get_by_summoner_id(ROUTE, &entry.summoner_id)
|
|
})
|
|
.map(tokio::spawn)
|
|
.collect::<Vec<_>>();
|
|
|
|
for (i, s) in sl.into_iter().enumerate() {
|
|
let summoner: Summoner = s
|
|
.await
|
|
.expect("tokio::spawn join error")
|
|
.map_err(|e| e.to_string())?;
|
|
println!("{}: {}", i + 1, summoner.name);
|
|
}
|
|
|
|
Ok(())
|
|
}
|