@@ -46,8 +46,8 @@ def json_output(*checks) -> str:
4646 return json .dumps ({"status" : status , "checks" : list (checks )})
4747
4848
49- def pass_scope (label : str = "Branch" ) -> main .ScopeResult :
50- return main .ScopeResult (label = label , checks = [make_check ("branch" )])
49+ def pass_scope (label : str = "Branch" , value : str = "" ) -> main .ScopeResult :
50+ return main .ScopeResult (label = label , checks = [make_check ("branch" , value = value )])
5151
5252
5353def fail_scope (label : str = "Commit 1/1" ) -> main .ScopeResult :
@@ -630,30 +630,41 @@ def test_raw_text_fallback_is_printed(self):
630630
631631class TestRenderJobSummary (unittest .TestCase ):
632632 def test_all_pass (self ):
633- body = main .render_job_summary ([pass_scope ("Branch" )])
633+ body = main .render_job_summary ([pass_scope ("Branch" , value = "main" )])
634634 self .assertTrue (body .startswith (main .REPORT_TITLE ))
635635 self .assertIn ("All checks passed (1 scope)" , body )
636636 self .assertIn ("<details>" , body )
637637 self .assertIn ("<summary>Show details</summary>" , body )
638638 self .assertIn ("```text" , body )
639639 self .assertIn ("Branch" , body )
640- self .assertIn (" ✔ Branch" , body )
640+ self .assertIn (" ✔ Branch (main) " , body )
641641
642642 def test_all_pass_groups_scopes_like_step_log (self ):
643643 results = [
644- pass_scope ("PR title" ),
645- pass_scope ("Commit 1/2" ),
646- pass_scope ("Commit 2/2" ),
647- pass_scope ("Branch" ),
648- pass_scope ("Author name" ),
649- pass_scope ("Author email" ),
644+ pass_scope ("PR title" , value = "feat: add login page" ),
645+ pass_scope ("Commit 1/2" , value = "feat: add user auth" ),
646+ pass_scope ("Commit 2/2" , value = "fix: resolve timeout" ),
647+ pass_scope ("Branch" , value = "feature/pr-12" ),
648+ pass_scope ("Author name" , value = "Jane Doe" ),
649+ pass_scope ("Author email" , value = "jane@example.com" ),
650650 ]
651651 body = main .render_job_summary (results )
652652 # Group headers in the details block mirror the step log ordering.
653653 self .assertLess (body .index ("Commit message" ), body .index ("Branch" ))
654654 self .assertLess (body .index ("Branch" ), body .index ("Author" ))
655- for scope in results :
656- self .assertIn (f" ✔ { scope .label } " , body )
655+ self .assertIn (" ✔ PR title (feat: add login page)" , body )
656+ self .assertIn (" ✔ Branch (feature/pr-12)" , body )
657+ self .assertIn (" ✔ Author email (jane@example.com)" , body )
658+
659+ def test_all_pass_truncates_long_values (self ):
660+ long_value = "x" * 200
661+ body = main .render_job_summary ([pass_scope ("Commit 1/1" , value = long_value )])
662+ self .assertIn (f" ✔ Commit 1/1 ({ 'x' * 77 } ...)" , body )
663+
664+ def test_all_pass_without_value_shows_plain_label (self ):
665+ body = main .render_job_summary ([pass_scope ("Branch" )])
666+ self .assertIn (" ✔ Branch" , body )
667+ self .assertNotIn (" ✔ Branch (" , body )
657668
658669 def test_failure_renders_table_with_rule_links (self ):
659670 body = main .render_job_summary ([fail_scope ("Commit 1/1" )])
0 commit comments