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,5 +1,3 @@
//! Tests for database migrations.
use rusqlite::Connection;
use std::path::PathBuf;
@@ -41,7 +39,6 @@ fn migration_002_creates_issues_table() {
let conn = create_test_db();
apply_migrations(&conn, 2);
// Verify issues table exists with expected columns
let columns: Vec<String> = conn
.prepare("PRAGMA table_info(issues)")
.unwrap()
@@ -124,13 +121,11 @@ fn migration_002_enforces_state_check() {
let conn = create_test_db();
apply_migrations(&conn, 2);
// First insert a project so we can reference it
conn.execute(
"INSERT INTO projects (id, gitlab_project_id, path_with_namespace) VALUES (1, 100, 'group/project')",
[],
).unwrap();
// Valid states should work
conn.execute(
"INSERT INTO issues (gitlab_id, project_id, iid, state, created_at, updated_at, last_seen_at)
VALUES (1, 1, 1, 'opened', 1000, 1000, 1000)",
@@ -143,7 +138,6 @@ fn migration_002_enforces_state_check() {
[],
).unwrap();
// Invalid state should fail
let result = conn.execute(
"INSERT INTO issues (gitlab_id, project_id, iid, state, created_at, updated_at, last_seen_at)
VALUES (3, 1, 3, 'invalid', 1000, 1000, 1000)",
@@ -158,7 +152,6 @@ fn migration_002_enforces_noteable_type_check() {
let conn = create_test_db();
apply_migrations(&conn, 2);
// Setup: project and issue
conn.execute(
"INSERT INTO projects (id, gitlab_project_id, path_with_namespace) VALUES (1, 100, 'group/project')",
[],
@@ -169,14 +162,12 @@ fn migration_002_enforces_noteable_type_check() {
[],
).unwrap();
// Valid: Issue discussion with issue_id
conn.execute(
"INSERT INTO discussions (gitlab_discussion_id, project_id, issue_id, noteable_type, last_seen_at)
VALUES ('abc123', 1, 1, 'Issue', 1000)",
[],
).unwrap();
// Invalid: noteable_type not in allowed values
let result = conn.execute(
"INSERT INTO discussions (gitlab_discussion_id, project_id, issue_id, noteable_type, last_seen_at)
VALUES ('def456', 1, 1, 'Commit', 1000)",
@@ -184,7 +175,6 @@ fn migration_002_enforces_noteable_type_check() {
);
assert!(result.is_err());
// Invalid: Issue type but no issue_id
let result = conn.execute(
"INSERT INTO discussions (gitlab_discussion_id, project_id, noteable_type, last_seen_at)
VALUES ('ghi789', 1, 'Issue', 1000)",
@@ -198,7 +188,6 @@ fn migration_002_cascades_on_project_delete() {
let conn = create_test_db();
apply_migrations(&conn, 2);
// Setup: project, issue, label, issue_label link, discussion, note
conn.execute(
"INSERT INTO projects (id, gitlab_project_id, path_with_namespace) VALUES (1, 100, 'group/project')",
[],
@@ -229,11 +218,9 @@ fn migration_002_cascades_on_project_delete() {
[],
).unwrap();
// Delete project
conn.execute("DELETE FROM projects WHERE id = 1", [])
.unwrap();
// Verify cascade: all related data should be gone
let issue_count: i64 = conn
.query_row("SELECT COUNT(*) FROM issues", [], |r| r.get(0))
.unwrap();
@@ -265,8 +252,6 @@ fn migration_002_updates_schema_version() {
assert_eq!(version, 2);
}
// === Migration 005 Tests ===
#[test]
fn migration_005_creates_milestones_table() {
let conn = create_test_db();
@@ -331,7 +316,6 @@ fn migration_005_milestones_cascade_on_project_delete() {
let conn = create_test_db();
apply_migrations(&conn, 5);
// Setup: project with milestone
conn.execute(
"INSERT INTO projects (id, gitlab_project_id, path_with_namespace) VALUES (1, 100, 'group/project')",
[],
@@ -341,11 +325,9 @@ fn migration_005_milestones_cascade_on_project_delete() {
[],
).unwrap();
// Delete project
conn.execute("DELETE FROM projects WHERE id = 1", [])
.unwrap();
// Verify milestone is gone
let count: i64 = conn
.query_row("SELECT COUNT(*) FROM milestones", [], |r| r.get(0))
.unwrap();
@@ -357,7 +339,6 @@ fn migration_005_assignees_cascade_on_issue_delete() {
let conn = create_test_db();
apply_migrations(&conn, 5);
// Setup: project, issue, assignee
conn.execute(
"INSERT INTO projects (id, gitlab_project_id, path_with_namespace) VALUES (1, 100, 'group/project')",
[],
@@ -373,10 +354,8 @@ fn migration_005_assignees_cascade_on_issue_delete() {
)
.unwrap();
// Delete issue
conn.execute("DELETE FROM issues WHERE id = 1", []).unwrap();
// Verify assignee link is gone
let count: i64 = conn
.query_row("SELECT COUNT(*) FROM issue_assignees", [], |r| r.get(0))
.unwrap();