@@ -360,28 +360,35 @@ const customerPayments: MonthlySalesChart = {
360360 unit : 'currency' ,
361361}
362362
363- it ( 'renders a customer-by-month matrix with accurate row, column and grand totals' , ( ) => {
364- render ( < SalesCustomerTable title = 'Goods Sold Customer-Wise' data = { customerPayments } /> )
365- const table = screen . getByRole ( 'table' )
366- expect ( within ( table )
367- . getAllByRole ( 'columnheader' )
368- . map ( cell => cell . textContent ) )
369- . toEqual ( [ 'Customer' , 'Apr 2026' , 'May 2026' , 'Jun 2026' , 'Annual' ] )
370- expect ( within ( table )
371- . getByRole ( 'row' , { name : / M e t r o / } ) )
372- . toHaveTextContent ( '$8,500.00' )
373- expect ( within ( table )
374- . getByRole ( 'row' , { name : / R e b e l / } ) )
375- . toHaveTextContent ( '$21,000.00' )
376- expect ( within ( table )
377- . getByRole ( 'row' , { name : / A N Z / } ) )
378- . toHaveTextContent ( '$15,500.00' )
379- expect ( within ( table )
380- . getByRole ( 'row' , { name : / ^ T o t a l / } ) . textContent )
381- . toBe ( 'Total$12,500.00$14,500.00$18,000.00$45,000.00' )
382- expect ( screen . getByRole ( 'region' ) )
383- . toHaveAttribute ( 'tabindex' , '0' )
384- } )
363+ it . each ( [ 'Goods Sold Customer-Wise' , 'Revenue Customer-Wise' ] ) (
364+ 'renders %s with totals directly below the month headers' ,
365+ title => {
366+ render ( < SalesCustomerTable title = { title } data = { customerPayments } /> )
367+ const table = screen . getByRole ( 'table' )
368+ expect ( within ( table )
369+ . getAllByRole ( 'columnheader' )
370+ . map ( cell => cell . textContent ) )
371+ . toEqual ( [ 'Customer' , 'Apr 2026' , 'May 2026' , 'Jun 2026' , 'Annual' ] )
372+ expect ( within ( table )
373+ . getByRole ( 'row' , { name : / M e t r o / } ) )
374+ . toHaveTextContent ( '$8,500.00' )
375+ expect ( within ( table )
376+ . getByRole ( 'row' , { name : / R e b e l / } ) )
377+ . toHaveTextContent ( '$21,000.00' )
378+ expect ( within ( table )
379+ . getByRole ( 'row' , { name : / A N Z / } ) )
380+ . toHaveTextContent ( '$15,500.00' )
381+ expect ( within ( table )
382+ . getByRole ( 'row' , { name : / ^ T o t a l / } ) . textContent )
383+ . toBe ( 'Total$12,500.00$14,500.00$18,000.00$45,000.00' )
384+ expect ( within ( table )
385+ . getAllByRole ( 'row' ) [ 1 ] )
386+ . toBe ( within ( table )
387+ . getByRole ( 'row' , { name : / ^ T o t a l / } ) )
388+ expect ( screen . getByRole ( 'region' ) )
389+ . toHaveAttribute ( 'tabindex' , '0' )
390+ } ,
391+ )
385392
386393it ( 'keeps unknown customer amounts distinct from zero and handles an empty dataset' , ( ) => {
387394 const view = render ( < SalesCustomerTable
@@ -443,6 +450,8 @@ it('places both customer tables at the bottom without duplicate requests or the
443450 expect ( screen . queryByRole ( 'heading' , { name : 'Member payments by customer' } ) ) . not . toBeInTheDocument ( )
444451 ids . forEach ( id => expect ( screen . getByRole ( 'heading' , { name : id } ) )
445452 . toBeInTheDocument ( ) )
453+ expect ( screen . getByRole ( 'heading' , { level : 1 } ) )
454+ . toHaveTextContent ( "Sales - FY '27" )
446455 expect ( screen . getByRole ( 'heading' , { name : 'Revenue' } ) )
447456 . toBeInTheDocument ( )
448457 expect ( screen . queryByRole ( 'heading' , { name : 'Bookings' } ) ) . not . toBeInTheDocument ( )
0 commit comments