forked from mirror/Riven
add live game test
parent
2d7a98ab2d
commit
a50fb77fde
|
@ -25,6 +25,24 @@ async_tests!{
|
||||||
rassert!(s.len() >= 142, "Expected masteries: {}.", s.len());
|
rassert!(s.len() >= 142, "Expected masteries: {}.", s.len());
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
spectator_combo: async {
|
||||||
|
let featured_p = RIOT_API.spectator_v4().get_featured_games(Region::EUW);
|
||||||
|
let featured = featured_p.await.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
rassert!(featured.game_list.len() > 0);
|
||||||
|
|
||||||
|
let summoner_name = &featured.game_list[0].participants[0].summoner_name;
|
||||||
|
let summoner_p = RIOT_API.summoner_v4().get_by_summoner_name(Region::EUW, summoner_name);
|
||||||
|
let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or("Failed to get summoner".to_owned())?;
|
||||||
|
|
||||||
|
let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(Region::EUW, &summoner.id);
|
||||||
|
let livegame_o = livegame_p.await.map_err(|e| e.to_string())?;
|
||||||
|
if let Some(livegame) = livegame_o {
|
||||||
|
let participant_match = livegame.participants.iter().find(|p| p.summoner_name == *summoner_name);
|
||||||
|
rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", summoner_name);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
// // TFT tests.
|
// // TFT tests.
|
||||||
// tftleaguev1_getchallengerleague: async {
|
// tftleaguev1_getchallengerleague: async {
|
||||||
// let p = RIOT_API.tft_league_v1().get_challenger_league(Region::EUW);
|
// let p = RIOT_API.tft_league_v1().get_challenger_league(Region::EUW);
|
||||||
|
|
Loading…
Reference in New Issue