#[cfg(test)]
mod tests {
use serde_json::json;
use tenuo::{extraction::extract_json_path, ConstraintValue};
#[test]
fn test_extract_object() {
let body = json!({
"meta": {
"cost": 100,
"owner": "admin"
}
});
let result = extract_json_path(&body, "meta");
if let Some(ConstraintValue::Object(map)) = result {
assert_eq!(map.get("cost"), Some(&ConstraintValue::Integer(100)));
assert_eq!(
map.get("owner"),
Some(&ConstraintValue::String("admin".to_string()))
);
} else {
panic!("Failed to extract object: {:?}", result);
}
}
}