use super::{DEPRECATED, FLOOR, SHAPES, edition, path_of, paths_of_type, signature};
use crate::channel::hello;
#[test]
fn the_edition_this_build_states_is_the_newest_stamp_it_vendored() {
assert_eq!(
hello::EDITION,
edition(),
"this foot states edition {}, its vendored ledger's newest stamp is {} — \
re-vendor src/corpus/ledger/shapes.rs and move the constant with it",
hello::EDITION,
edition(),
);
}
#[test]
fn the_floor_this_build_defaults_to_is_the_floor_it_vendored() {
assert_eq!(hello::FLOOR, FLOOR);
}
#[test]
fn no_path_a_foot_reads_is_stamped_above_the_floor() {
let above: Vec<&str> = SHAPES
.iter()
.flat_map(|shape| shape.signature.iter())
.filter(|&&(_, since)| since > FLOOR)
.map(|&(entry, _)| entry)
.collect();
assert!(
above.is_empty(),
"post-floor paths a reader must now default rather than require: {above:?}"
);
}
#[test]
fn nothing_this_foot_reads_has_been_listed_for_removal() {
let going: Vec<&str> = SHAPES
.iter()
.flat_map(|shape| shape.signature.iter())
.map(|&(entry, _)| entry)
.filter(|entry| DEPRECATED.contains(entry))
.collect();
assert!(
going.is_empty(),
"deprecated paths this foot reads: {going:?}"
);
}
#[test]
fn the_ledger_holds_the_seven_shapes_a_foot_speaks() {
let names: Vec<&str> = SHAPES.iter().map(|shape| shape.name).collect();
assert_eq!(
names,
[
"request/advertise",
"request/complete",
"request/invocations",
"reply/advertised",
"reply/invocations",
"reply/refusal",
"reply/routed",
]
);
assert!(
signature("reply/follow").is_none(),
"a seat's shape is a parity fact, not a vendored one"
);
}
#[test]
fn an_entry_carries_its_path_and_its_type() {
let queued = signature("reply/invocations").expect("a shape this foot speaks");
assert_eq!(path_of("/rows/[]/tool:string"), "/rows/[]/tool");
assert_eq!(path_of(":object"), "");
assert!(paths_of_type(queued, "string").contains(&"/rows/[]/tool"));
assert!(!paths_of_type(queued, "string").contains(&"/rows"));
}