Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created June 7, 2019 08:41
Show Gist options
  • Save pimeys/6d472b5704c67574e4416c342e535711 to your computer and use it in GitHub Desktop.
Save pimeys/6d472b5704c67574e4416c342e535711 to your computer and use it in GitHub Desktop.
#[test]
fn test_select() {
let mut path = Array::from(vec!["favorites", "foods"]);
path.push(1);
let mut fun = Select::new(path, Get::instance(Ref::instance("musti")));
fun.default("Chicken hearts");
let query = Query::from(fun);
let serialized = serde_json::to_value(&query).unwrap();
let expected = json!({
"select": ["favorites", "foods", 1],
"from": {
"get": {
"@ref": {
"id": "musti"
}
},
},
"default": "Chicken hearts"
});
assert_eq!(expected, serialized);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment