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

Function test_insert_edges_batch

tests/storage_suite/db_query_test.rs:433–458  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

431
432#[tokio::test]
433async fn test_insert_edges_batch() {
434 let db = setup_db().await;
435
436 let nodes: Vec<Node> = (0..4)
437 .map(|i| sample_node(&format!("be-{i}"), &format!("f{i}"), "src/lib.rs"))
438 .collect();
439 db.insert_nodes(&nodes).await.expect("insert_nodes failed");
440
441 let edges = vec![
442 sample_edge("be-0", "be-1", EdgeKind::Calls),
443 sample_edge("be-1", "be-2", EdgeKind::Uses),
444 sample_edge("be-2", "be-3", EdgeKind::Contains),
445 ];
446 db.insert_edges(&edges).await.expect("insert_edges failed");
447
448 // Contains is denormalized into nodes.parent_id since v9, so only the
449 // two non-Contains edges actually land in the edges table.
450 let all = db.get_all_edges().await.expect("get_all_edges failed");
451 assert_eq!(all.len(), 2);
452 let be_3 = db
453 .get_node_by_id("be-3")
454 .await
455 .expect("get_node_by_id failed")
456 .expect("be-3 should exist");
457 assert_eq!(be_3.parent_id.as_deref(), Some("be-2"));
458}
459
460#[tokio::test]
461async fn test_insert_edges_empty() {

Callers

nothing calls this directly

Calls 7

collectMethod · 0.80
insert_nodesMethod · 0.80
insert_edgesMethod · 0.80
get_node_by_idMethod · 0.80
setup_dbFunction · 0.70
sample_nodeFunction · 0.70
get_all_edgesMethod · 0.45

Tested by

no test coverage detected