File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 """
You can’t perform that action at this time.
0 commit comments