@@ -8207,7 +8207,7 @@ describe('SearchUIUtils', () => {
82078207 expect ( columns ) . not . toContain ( CONST . SEARCH . TABLE_COLUMNS . TAG ) ;
82088208 } ) ;
82098209
8210- test ( 'Should include COMMENTS column at the end in expense report view with custom columns' , ( ) => {
8210+ test ( 'Should place COMMENTS right before TOTAL in expense report view with custom columns' , ( ) => {
82118211 const baseTransaction = searchResults . data [ `transactions_${ transactionID } ` ] ;
82128212 const testTransaction = {
82138213 ...baseTransaction ,
@@ -8216,7 +8216,7 @@ describe('SearchUIUtils', () => {
82168216 } ;
82178217
82188218 // Use custom columns to trigger the custom columns path
8219- const visibleColumns = [ CONST . SEARCH . TABLE_COLUMNS . DATE , CONST . SEARCH . TABLE_COLUMNS . MERCHANT , CONST . SEARCH . TABLE_COLUMNS . TOTAL_AMOUNT ] ;
8219+ const visibleColumns = [ CONST . SEARCH . TABLE_COLUMNS . DATE , CONST . SEARCH . TABLE_COLUMNS . TOTAL ] ;
82208220 const columns = SearchUIUtils . getColumnsToShow ( {
82218221 currentAccountID : submitterAccountID ,
82228222 data : [ testTransaction ] ,
@@ -8226,8 +8226,28 @@ describe('SearchUIUtils', () => {
82268226 } ) ;
82278227
82288228 expect ( columns ) . toContain ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ;
8229- // COMMENTS should be at the end
8230- expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) . toBe ( columns . length - 1 ) ;
8229+ // TOTAL should be at the end, with COMMENTS immediately before it
8230+ expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) . toBe ( columns . length - 2 ) ;
8231+ expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . TOTAL ) ) . toBe ( columns . length - 1 ) ;
8232+ } ) ;
8233+
8234+ test ( 'Should place COMMENTS right before TOTAL in default expense report view' , ( ) => {
8235+ const baseTransaction = searchResults . data [ `transactions_${ transactionID } ` ] ;
8236+ const testTransaction = {
8237+ ...baseTransaction ,
8238+ transactionID : 'test' ,
8239+ merchant : 'Test Merchant' ,
8240+ } ;
8241+
8242+ const columns = SearchUIUtils . getColumnsToShow ( {
8243+ currentAccountID : submitterAccountID ,
8244+ data : [ testTransaction ] ,
8245+ isExpenseReportView : true ,
8246+ shouldShowCommentsColumn : true ,
8247+ } ) ;
8248+
8249+ expect ( columns ) . toContain ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ;
8250+ expect ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . COMMENTS ) ) . toBe ( columns . indexOf ( CONST . SEARCH . TABLE_COLUMNS . TOTAL ) - 1 ) ;
82318251 } ) ;
82328252
82338253 test ( 'Should not duplicate COMMENTS column when already in visible columns' , ( ) => {
0 commit comments