web: register the hohmann transfer tool and check graph references

This commit is contained in:
dev 2026-09-27 00:54:28 +08:00
parent 8e9a777aca
commit f1fd4ebddd
1 changed files with 47 additions and 0 deletions

View File

@ -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
);
}
}
}
}