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

Function test_find_relevant_context

tests/graph_suite/context_test.rs:347–391  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

345
346#[tokio::test]
347async fn test_find_relevant_context() {
348 use tempfile::TempDir;
349 use tracedecay::context::ContextBuilder;
350 use tracedecay::db::Database;
351
352 let dir = TempDir::new().unwrap();
353 let project = dir.path();
354
355 let (db, _) = Database::initialize(&project.join(".tracedecay/tracedecay.db"))
356 .await
357 .unwrap();
358 let node = Node {
359 id: "function:ctx_test".to_string(),
360 kind: NodeKind::Function,
361 name: "compute".to_string(),
362 qualified_name: "src/lib.rs::compute".to_string(),
363 file_path: "src/lib.rs".to_string(),
364 start_line: 1,
365 attrs_start_line: 1,
366 end_line: 5,
367 start_column: 0,
368 end_column: 1,
369 signature: Some("pub fn compute()".to_string()),
370 docstring: None,
371 visibility: Visibility::Pub,
372 is_async: false,
373 branches: 0,
374 loops: 0,
375 returns: 0,
376 max_nesting: 0,
377 unsafe_blocks: 0,
378 unchecked_calls: 0,
379 assertions: 0,
380 updated_at: 0,
381 parent_id: None,
382 };
383 db.insert_node(&node).await.unwrap();
384
385 let builder = ContextBuilder::new(&db, project);
386 let subgraph = builder
387 .find_relevant_context("compute", &BuildContextOptions::default())
388 .await
389 .unwrap();
390 assert!(!subgraph.nodes.is_empty());
391}
392
393#[tokio::test]
394async fn test_exclude_node_ids_deduplication() {

Callers

nothing calls this directly

Calls 2

insert_nodeMethod · 0.80
find_relevant_contextMethod · 0.80

Tested by

no test coverage detected