fix: align comment numbering with review sequence

This commit is contained in:
2026-04-08 23:44:43 +08:00
parent eb7dd1125d
commit 56f436592d
7 changed files with 44 additions and 10 deletions
+1
View File
@@ -35,6 +35,7 @@ fn model_json_roundtrip() {
line: Some(10),
root_comment: CommentItem {
id: 100,
review_id: Some(1),
user: "reviewer".into(),
created_at: "2026-04-08T12:00:00Z".into(),
path: Some("src/main.rs".into()),
+9 -2
View File
@@ -48,6 +48,7 @@ fn render_markdown_includes_expected_sections_and_preserves_comment_markdown() {
line: Some(9),
root_comment: CommentItem {
id: 11,
review_id: Some(1),
user: "bob".into(),
created_at: "2026-04-08T11:01:00Z".into(),
path: Some("src/main.rs".into()),
@@ -56,6 +57,7 @@ fn render_markdown_includes_expected_sections_and_preserves_comment_markdown() {
},
replies: vec![CommentItem {
id: 12,
review_id: Some(1),
user: "alice".into(),
created_at: "2026-04-08T11:02:00Z".into(),
path: Some("src/main.rs".into()),
@@ -72,10 +74,14 @@ fn render_markdown_includes_expected_sections_and_preserves_comment_markdown() {
assert!(md.contains("## Commits"));
assert!(md.contains("## Diff Stat"));
assert!(md.contains("## Review 1 (COMMENT)"));
assert!(md.contains("### Comment 7.1"));
assert!(md.contains("### Comment 7.1.1"));
assert!(md.contains("src/main.rs:9"));
assert!(md.contains("### Reply 7.1.1"));
assert!(md.contains("### Reply 7.1.1.1"));
assert!(md.contains("src/main.rs:12"));
let review_pos = md.find("## Review 1 (COMMENT)").unwrap();
let comment_pos = md.find("### Comment 7.1.1").unwrap();
assert!(comment_pos > review_pos);
assert!(!md.contains("## Comments (No Review)"));
assert!(md.contains("````md"));
assert!(md.contains("```rs\nlet x = 1;\n```"));
assert!(md.contains("looks good"));
@@ -111,6 +117,7 @@ fn render_markdown_uses_minimal_fence_for_plain_text() {
line: None,
root_comment: CommentItem {
id: 1,
review_id: None,
user: "bob".into(),
created_at: "2026-04-08T11:00:00Z".into(),
path: None,