@@ -394,4 +394,42 @@ describe('TransactionsDataTable tests', () => {
394394 { type : 'Refund as credits' , paymentMethod : 'Account Credit' }
395395 ] )
396396 } )
397+
398+ it ( 'PAID with full applied credit AND partial credit [PAD] - should show both applied credit and partial credit in dropdown' , async ( ) => {
399+ const transaction = createTestTransaction ( {
400+ statusCode : InvoiceStatus . PAID ,
401+ paymentMethod : PaymentTypes . PAD ,
402+ total : 100 ,
403+ appliedCredits : [ createAppliedCredit ( { id : 1 , amountApplied : 100 } ) ] , // Covers full amount
404+ partialRefunds : [ createPartialRefund ( {
405+ isCredit : true ,
406+ refundAmount : 30 ,
407+ createdName : 'Test User' ,
408+ createdBy : 'testuser' ,
409+ id : 1 ,
410+ createdOn : new Date ( '2023-01-01T10:00:00Z' )
411+ } ) ]
412+ } )
413+
414+ const { wrapper : testWrapper } = await setupTransactionTest ( transaction , wrapper )
415+
416+ expect ( testWrapper . vm . hasDropdownContent ( transaction ) ) . toBe ( true )
417+
418+ const dropdownItems = testWrapper . vm . getDropdownItems ( transaction )
419+
420+ expect ( dropdownItems ) . toHaveLength ( 2 )
421+
422+ const appliedCreditItem = dropdownItems . find ( item => item . id === 'credit-1' )
423+ expect ( appliedCreditItem ) . toBeTruthy ( )
424+ expect ( appliedCreditItem . amount ) . toBe ( '$100.00' )
425+ expect ( appliedCreditItem . paymentMethod ) . toBe ( 'Account Credit' )
426+ expect ( appliedCreditItem . isRefund ) . toBe ( false )
427+
428+ const partialCreditItem = dropdownItems . find ( item => item . isRefund )
429+ expect ( partialCreditItem ) . toBeTruthy ( )
430+ expect ( partialCreditItem . amount ) . toBe ( '-$30.00' )
431+ expect ( partialCreditItem . paymentMethod ) . toBe ( 'Account Credit' )
432+ expect ( partialCreditItem . type ) . toBe ( 'Refund as credits' )
433+ expect ( partialCreditItem . status ) . toBe ( 'Partially Credited' )
434+ } )
397435} )
0 commit comments