Skip to content

Commit 33fce4b

Browse files
increasing the coverage
1 parent 6bd4347 commit 33fce4b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/test_downstream_issue.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,18 @@ def test_truncate_jira_comment_body_long_without_url(self):
17531753
self.assertLessEqual(len(out), d.JIRA_COMMENT_BODY_MAX_CHARS)
17541754
self.assertIn("full thread not linked", out)
17551755

1756+
def test_truncate_jira_comment_body_degenerate_head_tail_budget(self):
1757+
"""
1758+
When the issue URL is huge, head+link can leave no room for body; cover
1759+
the minimal head/tail fallback (budget < 1 branch).
1760+
"""
1761+
huge_url = "https://github.com/o/r/issues/1" + ("x" * 40000)
1762+
body = "D" * (d.JIRA_COMMENT_BODY_MAX_CHARS + 200)
1763+
out = d._truncate_jira_comment_body(body, huge_url)
1764+
self.assertLessEqual(len(out), d.JIRA_COMMENT_BODY_MAX_CHARS)
1765+
self.assertIn("*(Truncated.)*", out)
1766+
self.assertIn("*(…)*", out)
1767+
17561768
@mock.patch("jira.client.JIRA")
17571769
def test_check_comments_for_duplicates(self, mock_client):
17581770
"""

0 commit comments

Comments
 (0)