| 407 | use super::*; |
| 408 | |
| 409 | fn fixture() -> Graph { |
| 410 | use atomic_core::{kg::ontology::Predicate, KgEdge, KgNode}; |
| 411 | let root = KgNode::new( |
| 412 | "urn:intent:root", |
| 413 | Class::WorkIntent, |
| 414 | "Make graph readable", |
| 415 | "test", |
| 416 | ) |
| 417 | .with_metadata(serde_json::json!({"human_key": "ATOM::test::1", "status": "in_progress"})); |
| 418 | let change = |id: &str, label: &str| KgNode::new(id, Class::Change, label, "test"); |
| 419 | Graph { |
| 420 | schema_version: 1, |
| 421 | root: root.id.clone(), |
| 422 | snapshot_identity: "snapshot".into(), |
| 423 | generation: 2, |
| 424 | ontology_version: "test".into(), |
| 425 | scope: "test", |
| 426 | nodes: vec![ |
| 427 | root, |
| 428 | change("urn:change:ABCDEFGHIJKLM", "Implement renderer"), |
| 429 | change("urn:change:RECORD", "Record intent"), |
| 430 | change("urn:change:DEPEND", "Earlier dependency"), |
| 431 | KgNode::new("urn:task:1", Class::Task, "Add tests", "test") |
| 432 | .with_metadata(serde_json::json!({"status": "open"})), |
| 433 | KgNode::new("urn:file:1", Class::File, "graph.rs", "test").with_metadata( |
| 434 | serde_json::json!({"path": "atomic-cli/src/commands/intent/graph.rs"}), |
| 435 | ), |
| 436 | ], |
| 437 | edges: vec![KgEdge::new( |
| 438 | "urn:change:ABCDEFGHIJKLM", |
| 439 | "urn:intent:root", |
| 440 | Predicate::Implements, |
| 441 | )], |
| 442 | implementing_changes: vec!["urn:change:ABCDEFGHIJKLM".into()], |
| 443 | captured_changes: vec![], |
| 444 | declared_changes: vec!["urn:change:ABCDEFGHIJKLM".into()], |
| 445 | intent_artifact: None, |
| 446 | recording_changes: vec!["urn:change:RECORD".into()], |
| 447 | dependency_changes: vec!["urn:change:DEPEND".into()], |
| 448 | reviewed_changes: vec![], |
| 449 | truncated: false, |
| 450 | missing_resources: vec![], |
| 451 | diagnostics: vec![], |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | #[test] |
| 456 | fn compact_tree_separates_roles_and_uses_readable_labels() { |