forked from mirror/Riven
1
0
Fork 0

Re-enable, update `spectator-v4` test

v/2.x.x
Mingwei Samuel 2024-01-15 11:34:27 -08:00
parent 1e136feaf3
commit af759728e3
1 changed files with 21 additions and 16 deletions

View File

@ -49,24 +49,29 @@ async_tests! {
Ok(()) Ok(())
}, },
// TODO: https://github.com/RiotGames/developer-relations/issues/602 // https://github.com/RiotGames/developer-relations/issues/602
// spectator_combo: async { spectator_combo: async {
// let featured_p = RIOT_API.spectator_v4().get_featured_games(ROUTE); let featured_p = RIOT_API.spectator_v4().get_featured_games(ROUTE);
// let featured = featured_p.await.map_err(|e| e.to_string())?; let featured = featured_p.await.map_err(|e| e.to_string())?;
// rassert!(!featured.game_list.is_empty()); rassert!(!featured.game_list.is_empty());
// let summoner_name = &featured.game_list[0].participants[0].summoner_name; // let summoner_name = &featured.game_list[0].participants[0].summoner_name;
// let summoner_p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, summoner_name); // let summoner_p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, summoner_name);
// let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to find summoner".to_owned())?; // let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to find summoner".to_owned())?;
// let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner.id); let featured_game = &featured.game_list[0];
// let livegame_o = livegame_p.await.map_err(|e| e.to_string())?; let participant = &featured_game.participants[0];
// if let Some(livegame) = livegame_o { let summoner_id = participant.summoner_id.as_ref()
// let participant_match = livegame.participants.iter().find(|p| p.summoner_name == *summoner_name); .ok_or_else(|| format!("Summoner in spectator featured game missing summoner ID: {}", &participant.summoner_name))?;
// rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", summoner_name);
// } let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner_id);
// Ok(()) 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 == participant.summoner_name);
rassert!(participant_match.is_some(), "Failed to find summoner in match: {}.", &participant.summoner_name);
}
Ok(())
},
} }
} }