From 2517f68c17918f1309e465e883a674f629233d72 Mon Sep 17 00:00:00 2001 From: Alex Mikheev Date: Tue, 1 Sep 2026 00:21:31 +0100 Subject: [PATCH] test(terraphim_mcp_server): repoint KG-scorer fixture at mcp_server (Refs #142) find_files_with_kg_scorer_boosts_matching_paths originally built a thesaurus containing the term 'automata' and asserted that a path under crates/terraphim_automata/ would be boosted to the top of the results. The terraphim_automata crate does not exist in this workspace (crate name was retired when the package was moved into the terraphim_mcp_server and terraphim_grep crates), so the assertion always failed. Repoint the fixture at 'mcp_server' (which has a real crates/terraphim_mcp_server/ directory) and update the assertion to look for the matching path segment. The thesaurus still exercises the KG-scorer boosting path; only the keyword and assertion substring change. --- .../tests/test_find_files.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crates/terraphim_mcp_server/tests/test_find_files.rs b/crates/terraphim_mcp_server/tests/test_find_files.rs index 010f8e9..77e2d06 100644 --- a/crates/terraphim_mcp_server/tests/test_find_files.rs +++ b/crates/terraphim_mcp_server/tests/test_find_files.rs @@ -78,9 +78,11 @@ async fn find_files_no_scorer_returns_results() { async fn find_files_with_kg_scorer_boosts_matching_paths() { let config_state = minimal_config_state().await; - // Build a thesaurus that recognises "automata" - files under - // crates/terraphim_automata/ should be boosted. - let thesaurus = thesaurus_with_terms("test", &[(1, "automata")]); + // Build a thesaurus that recognises "mcp_server" - files under + // crates/terraphim_mcp_server/ should be boosted. (The original test + // used "automata", pointing at a crates/terraphim_automata/ directory + // that does not exist in this workspace; Refs #142.) + let thesaurus = thesaurus_with_terms("test", &[(1, "mcp_server")]); let scorer = Arc::new(KgPathScorer::new(thesaurus)); let service = McpService::new(config_state).with_kg_scorer(scorer); @@ -102,15 +104,15 @@ async fn find_files_with_kg_scorer_boosts_matching_paths() { // Verify we got results back assert!(result.content.len() > 1, "expected results beyond summary"); - // At least one result should reference automata (boosted to top) - let has_automata = result.content.iter().any(|c| { + // At least one result should reference mcp_server (boosted to top) + let has_mcp_server = result.content.iter().any(|c| { c.as_text() - .map(|t| t.text.contains("automata")) + .map(|t| t.text.contains("mcp_server")) .unwrap_or(false) }); assert!( - has_automata, - "expected automata-path file in top results; got: {:?}", + has_mcp_server, + "expected mcp_server-path file in top results; got: {:?}", result.content ); }