11import { describe , expect , it } from 'bun:test' ;
22
3- import { formatRunLabel } from './run-label' ;
3+ import { formatRunDisplay , formatRunLabel } from './run-label' ;
44
55describe ( 'formatRunLabel' , ( ) => {
66 it ( 'starts with the run display name when available' , ( ) => {
@@ -15,15 +15,15 @@ describe('formatRunLabel', () => {
1515 ) . toBe ( 'dogfood-run-a · 01/06 10:00 · codex · 100%' ) ;
1616 } ) ;
1717
18- it ( 'shows DD/MM HH:mm · target · experiment · score ' , ( ) => {
18+ it ( 'uses a non-default experiment as the primary label when no display name is present ' , ( ) => {
1919 expect (
2020 formatRunLabel ( {
2121 target : 'llm-dry-run' ,
2222 experiment : 'issue-1198' ,
2323 timestamp : '2026-04-29T09:17:30.111Z' ,
2424 pass_rate : 0.8 ,
2525 } ) ,
26- ) . toBe ( '29/04 09:17 · llm-dry-run · issue-1198 · 80%' ) ;
26+ ) . toBe ( 'issue-1198 · 29/04 09:17 · llm-dry-run · 80%' ) ;
2727 } ) ;
2828
2929 it ( 'omits experiment when it is the default' , ( ) => {
@@ -55,4 +55,63 @@ describe('formatRunLabel', () => {
5555 } ) ,
5656 ) . toBe ( '07/05 10:56 · wtalms-stg · 0%' ) ;
5757 } ) ;
58+
59+ it ( 'uses one compact timestamp for remote timestamp-only run names' , ( ) => {
60+ const display = formatRunDisplay ( {
61+ display_name : '2026-03-27T05-00-00-000Z' ,
62+ filename : 'remote::2026-03-27T05-00-00-000Z' ,
63+ target : 'av-fis-target' ,
64+ timestamp : '2026-03-27T05:00:00.000Z' ,
65+ pass_rate : 1 ,
66+ } ) ;
67+
68+ expect ( display . primary ) . toBe ( '27/03 05:00' ) ;
69+ expect ( display . secondary ) . toBe ( 'av-fis-target · 100%' ) ;
70+ expect ( display . label ) . toBe ( '27/03 05:00 · av-fis-target · 100%' ) ;
71+ expect ( display . label . match ( / 2 7 \/ 0 3 0 5 : 0 0 / g) ) . toHaveLength ( 1 ) ;
72+ expect ( display . title ) . toContain ( 'Run ID: remote::2026-03-27T05-00-00-000Z' ) ;
73+ expect ( display . title ) . toContain ( 'Display name: 2026-03-27T05-00-00-000Z' ) ;
74+ } ) ;
75+
76+ it ( 'keeps a local human display name as the primary label' , ( ) => {
77+ const display = formatRunDisplay ( {
78+ display_name : 'local fixture run' ,
79+ filename : '2026-06-08T20-00-00-000Z' ,
80+ target : 'local-target' ,
81+ timestamp : '2026-06-08T20:00:00.000Z' ,
82+ pass_rate : 1 ,
83+ } ) ;
84+
85+ expect ( display . primary ) . toBe ( 'local fixture run' ) ;
86+ expect ( display . secondary ) . toBe ( '08/06 20:00 · local-target · 100%' ) ;
87+ expect ( display . label ) . toBe ( 'local fixture run · 08/06 20:00 · local-target · 100%' ) ;
88+ } ) ;
89+
90+ it ( 'falls back to a non-default experiment before timestamp-only run IDs' , ( ) => {
91+ const display = formatRunDisplay ( {
92+ display_name : '2026-03-27T05-00-00-000Z' ,
93+ filename : 'remote::smoke-regression::2026-03-27T05-00-00-000Z' ,
94+ experiment : 'smoke-regression' ,
95+ target : 'azure' ,
96+ timestamp : '2026-03-27T05:00:00.000Z' ,
97+ pass_rate : 0.5 ,
98+ } ) ;
99+
100+ expect ( display . primary ) . toBe ( 'smoke-regression' ) ;
101+ expect ( display . secondary ) . toBe ( '27/03 05:00 · azure · 50%' ) ;
102+ } ) ;
103+
104+ it ( 'can omit pass rate when another UI column already shows it' , ( ) => {
105+ const display = formatRunDisplay (
106+ {
107+ display_name : 'local fixture run' ,
108+ target : 'local-target' ,
109+ timestamp : '2026-06-08T20:00:00.000Z' ,
110+ pass_rate : 1 ,
111+ } ,
112+ { includePassRate : false } ,
113+ ) ;
114+
115+ expect ( display . label ) . toBe ( 'local fixture run · 08/06 20:00 · local-target' ) ;
116+ } ) ;
58117} ) ;
0 commit comments