Regen for match-v5.MatchInfoDto docs casing fix, update tests

- https://github.com/RiotGames/developer-relations/issues/540
- https://github.com/MingweiSamuel/riotapi-schema/issues/28
This commit is contained in:
Mingwei Samuel 2021-09-27 19:38:20 -07:00
parent 3cd41bce4c
commit 8d2bcfe694
5 changed files with 30 additions and 6 deletions

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1
// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Automatically generated endpoint handles.

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1
// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Metadata about the Riot API and Riven.
//!

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1
// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Data transfer structs.
//!
@ -745,10 +745,10 @@ pub mod match_v5 {
#[derive(serde::Serialize, serde::Deserialize)]
pub struct Metadata {
/// Match data version.
#[serde(rename = "data_version")]
#[serde(rename = "dataVersion")]
pub data_version: String,
/// Match id.
#[serde(rename = "match_id")]
#[serde(rename = "matchId")]
pub match_id: String,
/// A list of participant PUUIDs.
#[serde(rename = "participants")]

View file

@ -65,7 +65,7 @@ macro_rules! rassert {
};
( $x:expr, $format:expr $(, $arg:expr)* ) => {
{
if $x { Ok(()) } else { Err( format!($format, $( $arg )* ) ) }?
if $x { Ok(()) } else { Err( format!($format $(, $arg )* ) ) }?
}
};
}

View file

@ -12,6 +12,8 @@ use riven::models::tournament_stub_v4::*;
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
static MATCHES: [&'static str; 3] = [ "NA1_3923487226", "NA1_4049206905", "NA1_4052515784" ];
async_tests!{
my_runner {
// Champion Mastery tests.
@ -59,5 +61,27 @@ async_tests!{
}
}
},
match_v5_get: async {
for matche in MATCHES {
let p = RIOT_API.match_v5().get_match(ROUTE, matche);
let m = p.await.map_err(|e| e.to_string())?.ok_or(format!("Match {} not found.", matche))?;
rassert_eq!(matche, m.metadata.match_id, "Bad match id? Sent {}, received {}.", matche, m.metadata.match_id);
rassert!(!m.metadata.participants.is_empty(), "Match should have participants.");
rassert!(!m.info.teams.is_empty(), "Match should have teams.");
}
Ok(())
},
match_v5_get_timeline: async {
for matche in MATCHES {
let p = RIOT_API.match_v5().get_timeline(ROUTE, matche);
let m = p.await.map_err(|e| e.to_string())?.ok_or(format!("Match timeline {} not found.", matche))?;
rassert_eq!(matche, m.metadata.match_id, "Bad match id? Sent {}, received {}.", matche, m.metadata.match_id);
rassert!(!m.metadata.participants.is_empty(), "Match should have participants.");
rassert_eq!(matche, format!("NA1_{}", m.info.game_id), "Match number ID should match.");
rassert!(!m.info.frames.is_empty(), "Match timleine should have frames.");
}
Ok(())
},
}
}