use super::{PIN, UNPIN, pin, unpin};
use crate::verbs::{find, table};
use serde_json::json;
#[test]
fn the_pin_pair_are_rows_in_the_one_table() {
assert_eq!(find("pin"), Some(PIN));
assert_eq!(find("unpin"), Some(UNPIN));
assert!(table().contains(&PIN) && table().contains(&UNPIN));
assert!(PIN.addresses_a_workspace() && UNPIN.addresses_a_workspace());
assert_eq!(PIN.usage(), "lernie pin <workspace>");
assert_eq!(UNPIN.usage(), "lernie unpin <workspace>");
}
#[test]
fn each_door_builds_the_assertion_it_names() {
assert_eq!(
pin("home".to_owned()),
json!({"op": "pin", "workspace": "home"})
);
assert_eq!(
unpin("home".to_owned()),
json!({"op": "unpin", "workspace": "home"})
);
assert_eq!(
PIN.envelope(vec!["home".to_owned()])
.expect("the row's arity"),
pin("home".to_owned()),
"the door and the typed word are one gesture"
);
}