@@ -90,6 +90,42 @@ describe("commitments command", () => {
9090 ] ) ;
9191 } ) ;
9292
93+ it ( "keeps fixed-width table columns aligned when values are truncated" , async ( ) => {
94+ mocks . listCommitments . mockResolvedValue ( [
95+ commitment ( {
96+ id : "cm_abcdefghijklmnopqrstuvwxyz" ,
97+ agentId : "agent-with-a-very-long-name" ,
98+ channel : "telegram" ,
99+ to : "recipient-with-a-very-long-address" ,
100+ suggestedText :
101+ "This suggested text is intentionally long enough to exceed the table cell width and be truncated." ,
102+ } ) ,
103+ ] ) ;
104+ const { runtime, logs } = createRuntime ( ) ;
105+
106+ await commitmentsListCommand ( { } , runtime ) ;
107+
108+ const tableLines = logs . map ( stripAnsi ) . slice ( 3 ) ;
109+ const [ header , row ] = tableLines ;
110+ if ( ! header || ! row ) {
111+ throw new Error ( "Expected commitments table header and row" ) ;
112+ }
113+ expect ( row ) . toContain ( "…" ) ;
114+ expect ( row ) . not . toContain ( "..." ) ;
115+ const rowValuesByHeader = new Map ( [
116+ [ "Status" , "pending" ] ,
117+ [ "Kind" , "event_check_in" ] ,
118+ [ "Due" , "2026-04-30T17:00:00.000Z" ] ,
119+ [ "Scope" , "agent-with-a-very-long-name" ] ,
120+ [ "Suggested text" , "This suggested text" ] ,
121+ ] ) ;
122+ for ( const [ label , rowValue ] of rowValuesByHeader ) {
123+ const expectedColumn = header . indexOf ( label ) ;
124+ expect ( expectedColumn ) . toBeGreaterThanOrEqual ( 0 ) ;
125+ expect ( row . indexOf ( rowValue ) ) . toBe ( expectedColumn ) ;
126+ }
127+ } ) ;
128+
93129 it ( "tolerates Date-invalid commitment due timestamps in table output" , async ( ) => {
94130 mocks . listCommitments . mockResolvedValue ( [
95131 commitment ( {
0 commit comments