2019-11-07 20:45:13 +00:00
|
|
|
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
|
|
|
|
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
|
2019-10-30 20:24:07 +00:00
|
|
|
|
|
|
|
mod async_tests;
|
2019-10-31 05:52:00 +00:00
|
|
|
mod testutils;
|
|
|
|
use testutils::*;
|
2019-10-30 20:24:07 +00:00
|
|
|
|
|
|
|
use colored::*;
|
|
|
|
|
|
|
|
use riven::consts::*;
|
|
|
|
|
|
|
|
|
|
|
|
async_tests!{
|
|
|
|
my_runner {
|
|
|
|
// Champion Mastery tests.
|
|
|
|
championmastery_getscore_ma5tery: async {
|
|
|
|
let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score(Region::EUW, ids::SUMMONER_ID_MA5TERY);
|
2019-11-08 00:06:01 +00:00
|
|
|
let s = p.await.map_err(|e| e.to_string())?;
|
2019-10-30 20:24:07 +00:00
|
|
|
rassert!(969 <= s && s <= 1000, "Unexpected ma5tery score: {}.", s);
|
|
|
|
Ok(())
|
|
|
|
},
|
|
|
|
championmastery_getall_ma5tery: async {
|
|
|
|
let p = RIOT_API.champion_mastery_v4().get_all_champion_masteries(Region::EUW, ids::SUMMONER_ID_MA5TERY);
|
2019-11-08 00:06:01 +00:00
|
|
|
let s = p.await.map_err(|e| e.to_string())?;
|
2019-10-30 20:24:07 +00:00
|
|
|
rassert!(s.len() >= 142, "Expected masteries: {}.", s.len());
|
|
|
|
Ok(())
|
|
|
|
},
|
2019-11-05 07:29:46 +00:00
|
|
|
// // TFT tests.
|
|
|
|
// tftleaguev1_getchallengerleague: async {
|
|
|
|
// let p = RIOT_API.tft_league_v1().get_challenger_league(Region::EUW);
|
2019-11-08 00:06:01 +00:00
|
|
|
// let l = p.await.map_err(|e| e.to_string())?;
|
2019-11-05 07:29:46 +00:00
|
|
|
// rassert!(l.entries.len() > 10, "Expected a few challenger players, got: {}.", l.entries.len());
|
|
|
|
// Ok(())
|
|
|
|
// },
|
|
|
|
// tftmatchv1_getmatch: async {
|
|
|
|
// let p = RIOT_API.tft_match_v1().get_match(Region::AMERICAS, "PBE1_4328907912");
|
|
|
|
// let _m = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT match.".to_owned())?;
|
|
|
|
// Ok(())
|
|
|
|
// },
|
|
|
|
// tftsummonerv1_getbyname: async {
|
|
|
|
// let p = RIOT_API.tft_summoner_v1().get_by_summoner_name(Region::EUW, "相当猥琐");
|
|
|
|
// let _s = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get TFT summoner.".to_owned())?;
|
|
|
|
// Ok(())
|
|
|
|
// },
|
2019-10-30 20:24:07 +00:00
|
|
|
}
|
|
|
|
}
|