From b821314492fe3c0abd25782657fd8f72cd3da2ca Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Thu, 19 May 2022 00:42:35 -0700 Subject: [PATCH] Regen and add `lol-challenges-v1.getAllChallengeConfigs` and `.getChallengeConfigs` test --- riven/src/endpoints.rs | 2 +- riven/src/meta.rs | 2 +- riven/src/models.rs | 15 ++++++++++----- riven/tests/tests_la1.rs | 23 +++++++++++++++++++++-- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index 1fd6446..49a7969 100644 --- a/riven/src/endpoints.rs +++ b/riven/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version d2e2d8db61e32b60f6722b887694538659c20436 +// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c //! Automatically generated endpoint handles. #![allow(clippy::let_and_return, clippy::too_many_arguments)] diff --git a/riven/src/meta.rs b/riven/src/meta.rs index 3ab8731..7d716ca 100644 --- a/riven/src/meta.rs +++ b/riven/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version d2e2d8db61e32b60f6722b887694538659c20436 +// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c //! Metadata about the Riot API and Riven. //! diff --git a/riven/src/models.rs b/riven/src/models.rs index c40287f..e1ec9b5 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version d2e2d8db61e32b60f6722b887694538659c20436 +// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c #![allow(missing_docs)] @@ -380,14 +380,19 @@ pub mod lol_challenges_v1 { pub id: i64, #[serde(rename = "localizedNames")] pub localized_names: std::collections::HashMap>, + /// DISABLED - not visible and not calculated, HIDDEN - not visible, but calculated, ENABLED - visible and calculated, ARCHIVED - visible, but not calculated #[serde(rename = "state")] - pub state: State, + pub state: String, + /// LIFETIME - stats are incremented without reset, SEASON - stats are accumulated by season and reset at the beginning of new season #[serde(rename = "tracking")] - pub tracking: Tracking, + #[serde(skip_serializing_if = "Option::is_none")] + pub tracking: Option, #[serde(rename = "startTimestamp")] - pub start_timestamp: i64, + #[serde(skip_serializing_if = "Option::is_none")] + pub start_timestamp: Option, #[serde(rename = "endTimestamp")] - pub end_timestamp: i64, + #[serde(skip_serializing_if = "Option::is_none")] + pub end_timestamp: Option, #[serde(rename = "leaderboard")] pub leaderboard: bool, #[serde(rename = "thresholds")] diff --git a/riven/tests/tests_la1.rs b/riven/tests/tests_la1.rs index 4eb4b8c..fabca7f 100644 --- a/riven/tests/tests_la1.rs +++ b/riven/tests/tests_la1.rs @@ -13,6 +13,25 @@ const ROUTE: PlatformRoute = PlatformRoute::LA1; async_tests! { my_runner { + lol_challenges_v1_check_configs: async { + let challenges = RIOT_API.lol_challenges_v1().get_all_challenge_configs(ROUTE) + .await.map_err(|e| e.to_string())?; + rassert!(!challenges.is_empty()); + + for challenge in challenges.iter() { + rassert!(!challenge.localized_names.is_empty()); + rassert!(!challenge.thresholds.is_empty()); + } + + // Spot-check 10% of the challenge IDs. + for challenge in challenges.iter().step_by(10) { + RIOT_API.lol_challenges_v1().get_challenge_configs(ROUTE, challenge.id) + .await.map_err(|e| format!("Failed to get challenge config with id {}\n{}", challenge.id, e))? + .ok_or_else(|| format!("Challenge config with id {} returned 404", challenge.id))?; + } + + Ok(()) + }, lol_challenges_v1_check_percentiles: async { // Check all percentiles. let percentiles = RIOT_API.lol_challenges_v1().get_all_challenge_percentiles(ROUTE) @@ -22,8 +41,8 @@ async_tests! { // Spot-check 10% of the challenge IDs. for &challenge_id in percentiles.keys().step_by(10) { RIOT_API.lol_challenges_v1().get_challenge_percentiles(ROUTE, challenge_id) - .await.map_err(|e| format!("Failed to get challenge with id {}\n{}", challenge_id, e))? - .ok_or_else(|| format!("Challenge with id {} returned 404", challenge_id))?; + .await.map_err(|e| format!("Failed to get challenge percentile with id {}\n{}", challenge_id, e))? + .ok_or_else(|| format!("Challenge percentile with id {} returned 404", challenge_id))?; } Ok(())