use crate::{async_evaluate, GarlandTools, Job, Language};
#[test]
fn test_garland_tools_new_language_default() {
let garland_tools: GarlandTools = Default::default();
assert_eq!(garland_tools.language, Language::ENGLISH);
}
#[test]
fn test_garland_tools_new_language_english() {
let garland_tools = GarlandTools::new(Language::ENGLISH);
assert_eq!(garland_tools.language, Language::ENGLISH);
}
#[test]
fn test_garland_tools_new_language_german() {
let garland_tools = GarlandTools::new(Language::GERMAN);
assert_eq!(garland_tools.language, Language::GERMAN);
}
#[test]
fn test_garland_tools_new_language_french() {
let garland_tools = GarlandTools::new(Language::FRENCH);
assert_eq!(garland_tools.language, Language::FRENCH);
}
#[test]
fn test_garland_tools_new_language_japanese() {
let garland_tools = GarlandTools::new(Language::JAPANESE);
assert_eq!(garland_tools.language, Language::JAPANESE);
}
macro_rules! test_garland_tools_endpoint {
($name:ident, $function:ident) => {
#[test]
fn $name() {
let garland_tools: GarlandTools = Default::default();
let result: crate::garland_tools::ResultJSON =
async_evaluate!(garland_tools.$function());
println!("{:?}", result);
assert!(result.is_ok());
let object = result.unwrap();
println!("{:?}", object);
assert!(object.is_object());
}
};
($name:ident, $function:ident, $id:expr) => {
#[test]
fn $name() {
let garland_tools: GarlandTools = Default::default();
let result: crate::garland_tools::ResultJSON =
async_evaluate!(garland_tools.$function($id));
assert!(result.is_ok());
let object = result.unwrap();
assert!(object.is_object() || object.is_array());
}
};
($name:ident, $function:ident, $id0:expr, $id1:expr) => {
#[test]
fn $name() {
let garland_tools: GarlandTools = Default::default();
let result: crate::garland_tools::ResultBytes =
async_evaluate!(garland_tools.$function($id0, $id1));
assert!(result.is_ok());
result.unwrap();
}
};
}
test_garland_tools_endpoint!(test_garland_tools_achievement, achievement, 1);
test_garland_tools_endpoint!(test_garland_tools_achievements, achievements);
test_garland_tools_endpoint!(test_garland_tools_data, data);
test_garland_tools_endpoint!(test_garland_tools_fate, fate, 1631);
test_garland_tools_endpoint!(test_garland_tools_fates, fates);
test_garland_tools_endpoint!(test_garland_tools_fishing, fishing);
test_garland_tools_endpoint!(test_garland_tools_instance, instance, 1);
test_garland_tools_endpoint!(test_garland_tools_instances, instances);
test_garland_tools_endpoint!(test_garland_tools_item, item, 2);
test_garland_tools_endpoint!(test_garland_tools_leve, leve, 21);
test_garland_tools_endpoint!(test_garland_tools_leves, leves);
test_garland_tools_endpoint!(test_garland_tools_mob, mob, 20000000002);
test_garland_tools_endpoint!(test_garland_tools_mobs, mobs);
test_garland_tools_endpoint!(test_garland_tools_node, node, 153);
test_garland_tools_endpoint!(test_garland_tools_nodes, nodes);
test_garland_tools_endpoint!(test_garland_tools_npc, npc, 1000063);
test_garland_tools_endpoint!(test_garland_tools_npcs, npcs);
test_garland_tools_endpoint!(test_garland_tools_quest, quest, 65537);
test_garland_tools_endpoint!(test_garland_tools_quests, quests);
test_garland_tools_endpoint!(test_garland_tools_status, status, 1);
test_garland_tools_endpoint!(test_garland_tools_statuses, statuses);
test_garland_tools_endpoint!(
test_garland_tools_leveling_gear,
leveling_gear,
Job::Paladin
);
test_garland_tools_endpoint!(test_garland_tools_endgame_gear, endgame_gear, Job::Paladin);
test_garland_tools_endpoint!(
test_garland_tools_map_zone,
map_zone,
String::from("La Noscea"),
String::from("Lower La Noscea")
);
test_garland_tools_endpoint!(test_garland_tools_icon, icon, String::from("item"), 22614);
test_garland_tools_endpoint!(test_garland_tools_search, search, "Radiant".to_string());