MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / test_insert_and_get_node

Function test_insert_and_get_node

tests/storage_suite/db_test.rs:100–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98
99#[tokio::test]
100async fn test_insert_and_get_node() {
101 let (db, _dir) = setup_db().await;
102 let node = sample_node("node-1", "process_data", "src/main.rs");
103
104 db.insert_node(&node).await.expect("failed to insert node");
105
106 let fetched = db
107 .get_node_by_id("node-1")
108 .await
109 .expect("failed to get node")
110 .expect("node should exist");
111
112 assert_eq!(fetched.id, "node-1");
113 assert_eq!(fetched.name, "process_data");
114 assert_eq!(fetched.kind, NodeKind::Function);
115 assert_eq!(fetched.qualified_name, "crate::process_data");
116 assert_eq!(fetched.file_path, "src/main.rs");
117 assert_eq!(fetched.start_line, 1);
118 assert_eq!(fetched.end_line, 10);
119 assert_eq!(fetched.signature, Some("fn process_data()".to_string()));
120 assert_eq!(
121 fetched.docstring,
122 Some("Documentation for process_data".to_string())
123 );
124 assert_eq!(fetched.visibility, Visibility::Pub);
125 assert!(!fetched.is_async);
126 assert_eq!(fetched.updated_at, 1000);
127}
128
129#[tokio::test]
130async fn test_insert_and_get_edge() {

Callers

nothing calls this directly

Calls 4

insert_nodeMethod · 0.80
get_node_by_idMethod · 0.80
setup_dbFunction · 0.70
sample_nodeFunction · 0.70

Tested by

no test coverage detected