web: register the hohmann transfer tool and check graph references
This commit is contained in:
parent
2a14c59264
commit
25f9b28e9e
47
src/state.rs
47
src/state.rs
|
|
@ -82,5 +82,52 @@ mod tests {
|
|||
state.docs.missing_links().is_empty(),
|
||||
"every cross reference should resolve"
|
||||
);
|
||||
for graph in std::iter::once(&state.graph.concepts).chain(state.graph.flows.iter()) {
|
||||
assert!(
|
||||
graph.dangling_edges().is_empty(),
|
||||
"every edge of {} should connect two nodes",
|
||||
graph.id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn graph_nodes_point_at_documents_and_interface_items() {
|
||||
let state = AppState::new();
|
||||
let graphs = std::iter::once(&state.graph.concepts).chain(state.graph.flows.iter());
|
||||
for graph in graphs {
|
||||
for node in &graph.nodes {
|
||||
if let Some(id) = &node.document {
|
||||
assert!(
|
||||
state.docs.document(id).is_some(),
|
||||
"node {} of {} names document {id}, which does not exist",
|
||||
node.id,
|
||||
graph.id
|
||||
);
|
||||
}
|
||||
if let Some(name) = &node.api {
|
||||
assert!(
|
||||
state.api.find_item(name).is_some(),
|
||||
"node {} of {} names interface item {name}, which does not exist",
|
||||
node.id,
|
||||
graph.id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tool_api_items_resolve() {
|
||||
let state = AppState::new();
|
||||
for tool in state.tools.entries() {
|
||||
for name in tool.api_items {
|
||||
assert!(
|
||||
state.api.find_item(name).is_some(),
|
||||
"tool {} names interface item {name}, which does not exist",
|
||||
tool.id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue