@@ -8251,7 +8251,7 @@ describe('SearchUIUtils', () => {
82518251 expect ( columns ) . not . toContain ( CONST . SEARCH . TABLE_COLUMNS . TAG ) ;
82528252 } ) ;
82538253
8254- test ( 'Should include COMMENTS column at the end in expense report view with custom columns' , ( ) => {
8254+ test ( 'Should place COMMENTS right before TOTAL in expense report view with custom columns' , ( ) => {
82558255 const baseTransaction = searchResults . data [ `transactions_${ transactionID } ` ] ;
82568256 const testTransaction = {
82578257 ...baseTransaction ,
@@ -8260,7 +8260,7 @@ describe('SearchUIUtils', () => {
82608260 } ;
82618261
82628262 // Use custom columns to trigger the custom columns path
8263- const visibleColumns = [ CONST . SEARCH . TABLE_COLUMNS . DATE , CONST . SEARCH . TABLE_COLUMNS . MERCHANT , CONST . SEARCH . TABLE_COLUMNS . TOTAL_AMOUNT ] ;
8263+ const visibleColumns = [ CONST . SEARCH . TABLE_COLUMNS . DATE , CONST . SEARCH . TABLE_COLUMNS . TOTAL ] ;
82648264 const columns = SearchUIUtils . getColumnsToShow ( {
82658265 currentAccountID : submitterAccountID ,
82668266 data : [ testTransaction ] ,
@@ -8270,8 +8270,28 @@ describe('SearchUIUtils', () => {
82708270 } ) ;
82718271
82728272 expect ( columns ) . toContain ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ;
8273- // COMMENTS should be at the end
8274- expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) . toBe ( columns . length - 1 ) ;
8273+ // TOTAL should be at the end, with COMMENTS immediately before it
8274+ expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) . toBe ( columns . length - 2 ) ;
8275+ expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . TOTAL ) ) . toBe ( columns . length - 1 ) ;
8276+ } ) ;
8277+
8278+ test ( 'Should place COMMENTS right before TOTAL in default expense report view' , ( ) => {
8279+ const baseTransaction = searchResults . data [ `transactions_${ transactionID } ` ] ;
8280+ const testTransaction = {
8281+ ...baseTransaction ,
8282+ transactionID : 'test' ,
8283+ merchant : 'Test Merchant' ,
8284+ } ;
8285+
8286+ const columns = SearchUIUtils . getColumnsToShow ( {
8287+ currentAccountID : submitterAccountID ,
8288+ data : [ testTransaction ] ,
8289+ isExpenseReportView : true ,
8290+ shouldShowCommentsColumn : true ,
8291+ } ) ;
8292+
8293+ expect ( columns ) . toContain ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ;
8294+ expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) . toBe ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . TOTAL ) - 1 ) ;
82758295 } ) ;
82768296
82778297 test ( 'Should not duplicate COMMENTS column when already in visible columns' , ( ) => {
0 commit comments