Massive Improvements & MVP Patches
This commit is contained in:
30
tests/test_review_format.py
Normal file
30
tests/test_review_format.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from gitea_codex_bot.services.review_format import format_result_comment
|
||||
|
||||
|
||||
def test_format_result_comment_uses_markdown_comment_verbatim_with_marker() -> None:
|
||||
body = format_result_comment(
|
||||
"abc1234",
|
||||
{
|
||||
"verdict": "correct",
|
||||
"confidence": 0.9,
|
||||
"summary": "ignored when markdown_comment exists",
|
||||
"findings": [],
|
||||
"markdown_comment": "## Codex Review\n\nAll good.\n\nNo issues found.",
|
||||
},
|
||||
)
|
||||
assert body.startswith("<!-- codex-review:head_sha=abc1234 -->\n## Codex Review")
|
||||
assert "All good.\n\nNo issues found." in body
|
||||
|
||||
|
||||
def test_format_result_comment_replaces_existing_marker() -> None:
|
||||
body = format_result_comment(
|
||||
"def5678",
|
||||
{
|
||||
"markdown_comment": "<!-- codex-review:head_sha=old -->\n## Codex Review\n\nText.",
|
||||
},
|
||||
)
|
||||
assert body.startswith("<!-- codex-review:head_sha=def5678 -->")
|
||||
assert "old" not in body.splitlines()[0]
|
||||
|
||||
Reference in New Issue
Block a user