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:
Taylor Eernisse
2026-02-05 00:04:39 -05:00
parent 65583ed5d6
commit dd2869fd98
9 changed files with 7 additions and 158 deletions

View File

@@ -1,8 +1,3 @@
//! Integration tests for FTS5 search.
//!
//! These tests create an in-memory SQLite database, apply migrations through 008 (FTS5),
//! seed documents, and verify search behavior.
use rusqlite::Connection;
fn create_test_db() -> Connection {
@@ -28,7 +23,6 @@ fn create_test_db() -> Connection {
.unwrap_or_else(|e| panic!("Migration {} failed: {}", version, e));
}
// Seed a project
conn.execute(
"INSERT INTO projects (id, gitlab_project_id, path_with_namespace) VALUES (1, 100, 'group/project')",
[],
@@ -110,7 +104,6 @@ fn fts_stemming_matches() {
"Deployment configuration for production servers.",
);
// "running" should match "runner" and "executing" via porter stemmer
let results =
lore::search::search_fts(&conn, "running", 10, lore::search::FtsQueryMode::Safe).unwrap();
assert!(
@@ -157,11 +150,9 @@ fn fts_special_characters_handled() {
"The C++ compiler segfaults on template metaprogramming.",
);
// Special characters should not crash the search
let results =
lore::search::search_fts(&conn, "C++ compiler", 10, lore::search::FtsQueryMode::Safe)
.unwrap();
// Safe mode sanitizes the query — it should still return results or at least not crash
assert!(results.len() <= 1);
}
@@ -169,7 +160,6 @@ fn fts_special_characters_handled() {
fn fts_result_ordering_by_relevance() {
let conn = create_test_db();
// Doc 1: "authentication" in title and content
insert_document(
&conn,
1,
@@ -177,7 +167,6 @@ fn fts_result_ordering_by_relevance() {
"Authentication system redesign",
"The authentication system needs a complete redesign. Authentication flows are broken.",
);
// Doc 2: "authentication" only in content, once
insert_document(
&conn,
2,
@@ -185,7 +174,6 @@ fn fts_result_ordering_by_relevance() {
"Login page update",
"Updated the login page with better authentication error messages.",
);
// Doc 3: unrelated
insert_document(
&conn,
3,
@@ -203,7 +191,6 @@ fn fts_result_ordering_by_relevance() {
.unwrap();
assert!(results.len() >= 2, "Should match at least 2 documents");
// Doc 1 should rank higher (more occurrences of the term)
assert_eq!(
results[0].document_id, 1,
"Document with more term occurrences should rank first"
@@ -246,7 +233,6 @@ fn fts_snippet_generated() {
.unwrap();
assert!(!results.is_empty());
// Snippet should contain some text (may have FTS5 highlight markers)
assert!(
!results[0].snippet.is_empty(),
"Snippet should be generated"
@@ -265,7 +251,6 @@ fn fts_triggers_sync_on_insert() {
"This is test content for FTS trigger verification.",
);
// Verify FTS table has an entry via direct query
let fts_count: i64 = conn
.query_row(
"SELECT COUNT(*) FROM documents_fts WHERE documents_fts MATCH 'test'",
@@ -289,7 +274,6 @@ fn fts_triggers_sync_on_delete() {
"This content will be deleted from the index.",
);
// Verify it's indexed
let before: i64 = conn
.query_row(
"SELECT COUNT(*) FROM documents_fts WHERE documents_fts MATCH 'deletable'",
@@ -299,11 +283,9 @@ fn fts_triggers_sync_on_delete() {
.unwrap();
assert_eq!(before, 1);
// Delete the document
conn.execute("DELETE FROM documents WHERE id = 1", [])
.unwrap();
// Verify it's removed from FTS
let after: i64 = conn
.query_row(
"SELECT COUNT(*) FROM documents_fts WHERE documents_fts MATCH 'deletable'",
@@ -318,7 +300,6 @@ fn fts_triggers_sync_on_delete() {
fn fts_null_title_handled() {
let conn = create_test_db();
// Discussion documents have NULL titles
conn.execute(
"INSERT INTO documents (id, source_type, source_id, project_id, title, content_text, content_hash, url)
VALUES (1, 'discussion', 1, 1, NULL, 'Discussion about API rate limiting strategies.', 'hash1', 'https://example.com/1')",