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,5 +1,3 @@
|
||||
//! Tests for DiffNote position extraction in note transformer.
|
||||
|
||||
use lore::gitlab::transformers::discussion::transform_notes_with_diff_position;
|
||||
use lore::gitlab::types::{
|
||||
GitLabAuthor, GitLabDiscussion, GitLabLineRange, GitLabLineRangePoint, GitLabNote,
|
||||
@@ -60,8 +58,6 @@ fn make_discussion(notes: Vec<GitLabNote>) -> GitLabDiscussion {
|
||||
}
|
||||
}
|
||||
|
||||
// === DiffNote Position Field Extraction ===
|
||||
|
||||
#[test]
|
||||
fn extracts_position_paths_from_diffnote() {
|
||||
let position = GitLabNotePosition {
|
||||
@@ -174,7 +170,7 @@ fn line_range_uses_old_line_fallback_when_new_line_missing() {
|
||||
line_code: None,
|
||||
line_type: Some("old".to_string()),
|
||||
old_line: Some(20),
|
||||
new_line: None, // missing - should fall back to old_line
|
||||
new_line: None,
|
||||
},
|
||||
end: GitLabLineRangePoint {
|
||||
line_code: None,
|
||||
@@ -203,8 +199,6 @@ fn line_range_uses_old_line_fallback_when_new_line_missing() {
|
||||
assert_eq!(notes[0].position_line_range_end, Some(25));
|
||||
}
|
||||
|
||||
// === Regular Notes (non-DiffNote) ===
|
||||
|
||||
#[test]
|
||||
fn regular_note_has_none_for_all_position_fields() {
|
||||
let note = make_basic_note(1, "2024-01-16T09:00:00.000Z");
|
||||
@@ -224,8 +218,6 @@ fn regular_note_has_none_for_all_position_fields() {
|
||||
assert_eq!(notes[0].position_head_sha, None);
|
||||
}
|
||||
|
||||
// === Strict Timestamp Parsing ===
|
||||
|
||||
#[test]
|
||||
fn returns_error_for_invalid_created_at_timestamp() {
|
||||
let mut note = make_basic_note(1, "2024-01-16T09:00:00.000Z");
|
||||
@@ -264,8 +256,6 @@ fn returns_error_for_invalid_resolved_at_timestamp() {
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
// === Mixed Discussion (DiffNote + Regular Notes) ===
|
||||
|
||||
#[test]
|
||||
fn handles_mixed_diffnote_and_regular_notes() {
|
||||
let position = GitLabNotePosition {
|
||||
@@ -286,16 +276,12 @@ fn handles_mixed_diffnote_and_regular_notes() {
|
||||
let notes = transform_notes_with_diff_position(&discussion, 100).unwrap();
|
||||
|
||||
assert_eq!(notes.len(), 2);
|
||||
// First note is DiffNote with position
|
||||
assert_eq!(notes[0].position_new_path, Some("file.rs".to_string()));
|
||||
assert_eq!(notes[0].position_new_line, Some(42));
|
||||
// Second note is regular with None position fields
|
||||
assert_eq!(notes[1].position_new_path, None);
|
||||
assert_eq!(notes[1].position_new_line, None);
|
||||
}
|
||||
|
||||
// === Position Preservation ===
|
||||
|
||||
#[test]
|
||||
fn preserves_note_position_index() {
|
||||
let pos1 = GitLabNotePosition {
|
||||
@@ -330,11 +316,8 @@ fn preserves_note_position_index() {
|
||||
assert_eq!(notes[1].position, 1);
|
||||
}
|
||||
|
||||
// === Edge Cases ===
|
||||
|
||||
#[test]
|
||||
fn handles_diffnote_with_empty_position_fields() {
|
||||
// DiffNote exists but all position fields are None
|
||||
let position = GitLabNotePosition {
|
||||
old_path: None,
|
||||
new_path: None,
|
||||
@@ -351,7 +334,6 @@ fn handles_diffnote_with_empty_position_fields() {
|
||||
|
||||
let notes = transform_notes_with_diff_position(&discussion, 100).unwrap();
|
||||
|
||||
// All position fields should be None, not cause an error
|
||||
assert_eq!(notes[0].position_old_path, None);
|
||||
assert_eq!(notes[0].position_new_path, None);
|
||||
}
|
||||
@@ -376,6 +358,5 @@ fn handles_file_position_type() {
|
||||
|
||||
assert_eq!(notes[0].position_type, Some("file".to_string()));
|
||||
assert_eq!(notes[0].position_new_path, Some("binary.bin".to_string()));
|
||||
// File-level comments have no line numbers
|
||||
assert_eq!(notes[0].position_new_line, None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user