| 426 | use super::*; |
| 427 | |
| 428 | fn fixture() -> Graph { |
| 429 | use atomic_core::{kg::ontology::Predicate, KgEdge, KgNode}; |
| 430 | let root = KgNode::new( |
| 431 | "urn:intent:root", |
| 432 | Class::WorkIntent, |
| 433 | "Make graph readable", |
| 434 | "test", |
| 435 | ) |
| 436 | .with_metadata(serde_json::json!({"human_key": "ATOM::test::1", "status": "in_progress"})); |
| 437 | let change = |id: &str, label: &str| KgNode::new(id, Class::Change, label, "test"); |
| 438 | Graph { |
| 439 | schema_version: 1, |
| 440 | root: root.id.clone(), |
| 441 | snapshot_identity: "snapshot".into(), |
| 442 | generation: 2, |
| 443 | ontology_version: "test".into(), |
| 444 | scope: "test", |
| 445 | nodes: vec![ |
| 446 | root, |
| 447 | change("urn:change:ABCDEFGHIJKLM", "Implement renderer"), |
| 448 | change("urn:change:RECORD", "Record intent"), |
| 449 | change("urn:change:DEPEND", "Earlier dependency"), |
| 450 | KgNode::new("urn:task:1", Class::Task, "Add tests", "test") |
| 451 | .with_metadata(serde_json::json!({"status": "open"})), |
| 452 | KgNode::new("urn:file:1", Class::File, "graph.rs", "test").with_metadata( |
| 453 | serde_json::json!({"path": "atomic-cli/src/commands/intent/graph.rs"}), |
| 454 | ), |
| 455 | ], |
| 456 | edges: vec![KgEdge::new( |
| 457 | "urn:change:ABCDEFGHIJKLM", |
| 458 | "urn:intent:root", |
| 459 | Predicate::Implements, |
| 460 | )], |
| 461 | implementing_changes: vec!["urn:change:ABCDEFGHIJKLM".into()], |
| 462 | captured_changes: vec![], |
| 463 | declared_changes: vec!["urn:change:ABCDEFGHIJKLM".into()], |
| 464 | intent_artifact: None, |
| 465 | recording_changes: vec!["urn:change:RECORD".into()], |
| 466 | dependency_changes: vec!["urn:change:DEPEND".into()], |
| 467 | truncated: false, |
| 468 | missing_resources: vec![], |
| 469 | diagnostics: vec![], |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | #[test] |
| 474 | fn compact_tree_separates_roles_and_uses_readable_labels() { |