test: Remove redundant comments from test files
Applies the same doc comment cleanup to test files: - Removes test module headers (//! lines) - Removes obvious test function comments - Retains comments explaining non-obvious test scenarios Test names should be descriptive enough to convey intent without additional comments. Complex test setup or assertions that need explanation retain their comments. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,3 @@
|
||||
//! Integration tests for hybrid search combining FTS + vector.
|
||||
//!
|
||||
//! Tests all three search modes (lexical, semantic, hybrid) and
|
||||
//! verifies graceful degradation when embeddings are unavailable.
|
||||
|
||||
use lore::core::db::create_connection;
|
||||
use lore::search::{FtsQueryMode, SearchFilters, SearchMode, search_fts, search_hybrid};
|
||||
use rusqlite::Connection;
|
||||
@@ -89,7 +84,6 @@ fn lexical_mode_uses_fts_only() {
|
||||
|
||||
assert!(!results.is_empty(), "Lexical search should find results");
|
||||
assert_eq!(results[0].document_id, 1);
|
||||
// Lexical mode should not produce Ollama-related warnings
|
||||
assert!(
|
||||
warnings.iter().all(|w| !w.contains("Ollama")),
|
||||
"Lexical mode should not warn about Ollama"
|
||||
@@ -98,12 +92,10 @@ fn lexical_mode_uses_fts_only() {
|
||||
|
||||
#[test]
|
||||
fn lexical_mode_no_embeddings_required() {
|
||||
// Use in-memory DB without sqlite-vec for pure FTS
|
||||
let conn = Connection::open_in_memory().unwrap();
|
||||
conn.pragma_update(None, "foreign_keys", "ON").unwrap();
|
||||
|
||||
let migrations_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("migrations");
|
||||
// Only apply through migration 008 (FTS5, no embeddings)
|
||||
for version in 1..=8 {
|
||||
let entries: Vec<_> = std::fs::read_dir(&migrations_dir)
|
||||
.unwrap()
|
||||
@@ -159,7 +151,7 @@ fn hybrid_mode_degrades_to_fts_without_client() {
|
||||
let (results, warnings) = rt
|
||||
.block_on(search_hybrid(
|
||||
&conn,
|
||||
None, // No Ollama client
|
||||
None,
|
||||
"performance slow",
|
||||
SearchMode::Hybrid,
|
||||
&filters,
|
||||
@@ -168,7 +160,6 @@ fn hybrid_mode_degrades_to_fts_without_client() {
|
||||
.unwrap();
|
||||
|
||||
assert!(!results.is_empty(), "Should fall back to FTS results");
|
||||
// Should warn about missing Ollama client
|
||||
assert!(
|
||||
warnings.iter().any(|w| w.to_lowercase().contains("vector")
|
||||
|| w.to_lowercase().contains("ollama")
|
||||
@@ -184,14 +175,12 @@ fn hybrid_mode_degrades_to_fts_without_client() {
|
||||
fn rrf_ranking_combines_signals() {
|
||||
use lore::search::rank_rrf;
|
||||
|
||||
// Two documents with different rankings in each signal
|
||||
let vector_results = vec![(1_i64, 0.1), (2, 0.5)]; // doc 1 closer
|
||||
let fts_results = vec![(2_i64, -5.0), (1, -3.0)]; // doc 2 higher BM25
|
||||
let vector_results = vec![(1_i64, 0.1), (2, 0.5)];
|
||||
let fts_results = vec![(2_i64, -5.0), (1, -3.0)];
|
||||
|
||||
let rrf = rank_rrf(&vector_results, &fts_results);
|
||||
|
||||
assert_eq!(rrf.len(), 2, "Should return both documents");
|
||||
// Both docs appear in both signals, so both get RRF scores
|
||||
for r in &rrf {
|
||||
assert!(r.rrf_score > 0.0, "RRF score should be positive");
|
||||
}
|
||||
@@ -235,7 +224,6 @@ fn filters_by_source_type() {
|
||||
|
||||
#[test]
|
||||
fn search_mode_variants_exist() {
|
||||
// Verify all enum variants compile and are distinct
|
||||
let hybrid = SearchMode::Hybrid;
|
||||
let lexical = SearchMode::Lexical;
|
||||
let semantic = SearchMode::Semantic;
|
||||
|
||||
Reference in New Issue
Block a user