update league tests for regen

This commit is contained in:
Mingwei Samuel 2025-01-10 15:45:55 -08:00
parent cc2f419dfb
commit 5b70c9203c

View file

@ -1,4 +1,6 @@
mod testutils; mod testutils;
use core::option::Option::None;
use riven::consts::*; use riven::consts::*;
use testutils::*; use testutils::*;
@ -26,9 +28,11 @@ async fn league_get_diamond() -> Result<(), String> {
Division::IV, Division::IV,
None, None,
); );
let d = p.await.map_err(|e| e.to_string())?; let opt = p.await.map_err(|e| e.to_string())?;
if d.is_empty() { if let Some(list) = opt {
eprintln!("Diamond league is empty!"); assert!(!list.is_empty(), "Returns 204 (`None`) when empty.");
} else {
eprintln!("Off-season, challenger league is empty.");
} }
Ok(()) Ok(())
} }
@ -38,8 +42,8 @@ async fn league_get_challenger() -> Result<(), String> {
let p = riot_api() let p = riot_api()
.league_v4() .league_v4()
.get_challenger_league(ROUTE, QueueType::RANKED_SOLO_5x5); .get_challenger_league(ROUTE, QueueType::RANKED_SOLO_5x5);
let d = p.await.map_err(|e| e.to_string())?; let ll = p.await.map_err(|e| e.to_string())?;
if d.entries.is_empty() { if ll.entries.is_empty() {
eprintln!("Off-season, challenger league is empty."); eprintln!("Off-season, challenger league is empty.");
} }
Ok(()) Ok(())
@ -54,8 +58,12 @@ async fn leagueexp_get_challenger() -> Result<(), String> {
Division::I, Division::I,
None, None,
); );
let d = p.await.map_err(|e| e.to_string())?; let opt = p.await.map_err(|e| e.to_string())?;
assert!(!d.is_empty(), "Returns 204 (`None`) when empty."); if let Some(list) = opt {
assert!(!list.is_empty(), "Returns 204 (`None`) when empty.");
} else {
eprintln!("Off-season, challenger league is empty.");
}
Ok(()) Ok(())
} }