test: update tests to pass after changes

This commit is contained in:
1337MARCEL 2024-10-23 02:48:44 +02:00 committed by Mingwei Samuel
parent a243e93609
commit c211e1d9a2
3 changed files with 82 additions and 3 deletions

View file

@ -0,0 +1,78 @@
mod testutils;
use riven::consts::*;
use testutils::*;
const ROUTE: PlatformRoute = PlatformRoute::JP1;
static TFT_MATCHES: &[&str] = &[
// 2024-08-28
"JP1_466820197",
// 2024-10-23
"JP1_476014499",
];
#[riven_test]
async fn tftmatchv1_get_list() -> Result<(), String> {
tft_match_v1_get(ROUTE.to_regional(), TFT_MATCHES).await
}
// /// Don't have acecess to tft-status-v1.
// #[riven_test]
// async fn tftstatusv1_getplatformdata() -> Result<(), String> {
// let p = riot_api().tft_status_v1().get_platform_data(ROUTE);
// let _s = p.await.map_err(|e| e.to_string())?;
// Ok(())
// }
#[riven_test]
async fn tftleaguev1_gettopratedladder() -> Result<(), String> {
let p = riot_api()
.tft_league_v1()
.get_top_rated_ladder(ROUTE, QueueType::RANKED_TFT_TURBO);
let l = p.await.map_err(|e| e.to_string())?;
rassert!(
l.len() > 10,
"Expected a few ranked players, got: {}.",
l.len()
);
Ok(())
}
#[riven_test]
async fn tftmatchv1_getmatch() -> Result<(), String> {
let p = riot_api()
.tft_match_v1()
.get_match(ROUTE.to_regional(), "JP1_466820197");
let _m = p
.await
.map_err(|e| e.to_string())?
.ok_or("Failed to get TFT match.".to_owned())?;
Ok(())
}
/// Get top rated player, get some of their matches.
#[riven_test]
async fn tft_combo() -> Result<(), String> {
let top_players = riot_api()
.tft_league_v1()
.get_top_rated_ladder(ROUTE, QueueType::RANKED_TFT_TURBO);
let top_players = top_players.await.map_err(|e| e.to_string())?;
rassert!(!top_players.is_empty());
let top_player_entry = &top_players[0];
let top_player = riot_api()
.tft_summoner_v1()
.get_by_summoner_id(ROUTE, &top_player_entry.summoner_id);
let top_player = top_player.await.map_err(|e| e.to_string())?;
println!("Top player has `puuid` {}.", top_player.puuid);
let match_ids = riot_api().tft_match_v1().get_match_ids_by_puuid(
ROUTE.to_regional(),
&top_player.puuid,
Some(10),
None,
None,
None,
);
let match_ids = match_ids.await.map_err(|e| e.to_string())?;
tft_match_v1_get(ROUTE.to_regional(), &*match_ids).await?;
Ok(())
}

View file

@ -14,7 +14,7 @@ async fn lol_challenges_v1_leaderboards_playerdata() -> Result<(), String> {
let challenge_id = CHALLENGE_ID_ARAM_1K_DPM; let challenge_id = CHALLENGE_ID_ARAM_1K_DPM;
let leaderboard = riot_api() let leaderboard = riot_api()
.lol_challenges_v1() .lol_challenges_v1()
.get_challenge_leaderboards(ROUTE, challenge_id, Tier::GRANDMASTER, None) .get_challenge_leaderboards(ROUTE, challenge_id, Tier::CHALLENGER, None)
.await .await
.map_err(|e| e.to_string())? .map_err(|e| e.to_string())?
.ok_or_else(|| { .ok_or_else(|| {

View file

@ -180,11 +180,12 @@ pub async fn tft_match_v1_get(
matche matche
)); ));
} }
// Due to Riot's addition of bots to TFT, this test is not possible anymore
if m.metadata.participants.len() != m.info.participants.len() { if m.metadata.participants.len() != m.info.participants.len() {
return Err(format!( eprintln!(
"Match {} participants do not line up with participant UUIDs.", "Match {} participants do not line up with participant UUIDs.",
matche matche
)); );
} }
if m.info.participants.is_empty() { if m.info.participants.is_empty() {
return Err(format!("Match {} should have participants (info).", matche)); return Err(format!("Match {} should have participants (info).", matche));