فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(A01/A05): native Windows cheque clearance chooses nondefault account, confirms before posting

davoodmehraban89 committed Oct 23, 2026 at 02:28 UTC d389f79b274145c19bf156cc0d21946dbdf0e93c
1 file changed +38 -8
tests/windows-vm-native-functional-matrix.cjs
+38 -8
@@ -542,30 +542,60 @@ async function nativeInactiveBankSettlementGuard() {
542 check(dateInput,'Native posted cheque must request the financial event date');
543 dateInput.value='1405/07/20'; // intentionally different from the cheque due date
544 document.getElementById('newStatus').value='cleared';
545 + cv._onChequeStatusSelection();
546 + check(document.getElementById('chqClearingAccount'),
547 + 'Explicit bank selection was not presented in posted cheque UI');
548 await cv._applyStatusChange(cheque.id);
546 - toast=[...document.querySelectorAll('.toast-error')].find(x=>
547 - x.textContent.includes('حساب بانک یا صندوق برای وصول چک مشخص نیست'));
548 - check(toast,'Cheque clearing with all banks inactive did not reject');
549 + toast=[...document.querySelectorAll('.toast-warning')].find(x=>
550 + x.textContent.includes('حساب بانک یا صندوق را انتخاب کنید'));
551 + check(toast,'Clearing without selected active bank did not visibly reject');
552 check((await db.get('cheques',cheque.id)).status==='pending'&&
553 (await db.getAll('journal_entries')).length===journalCount&&
554 !(await db.getAll('treasury')).some(t=>t.refChequeId===cheque.id),
555 'Rejected cheque clearance modified ledger or treasury');
556 toast.querySelector('.toast-close')?.click();
557 + FINORA.Modal.close();
558 await db.put('treasury',active);
559 + await db.put('treasury',{...secondary,isActive:true});
560 + await cv.changeStatus(cheque.id);
561 + document.getElementById('newStatus').value='cleared';
562 + document.getElementById('chqEventDate').value='1405/07/20';
563 + cv._onChequeStatusSelection();
564 + const selected=document.getElementById('chqClearingAccount');
565 + check([...selected.options].some(x=>x.value===secondary.id),
566 + 'Actual secondary bank not selectable in clearing UI');
567 + selected.value=secondary.id; // bank other than the default
568 await cv._applyStatusChange(cheque.id);
556 - const cleared=await db.get('cheques',cheque.id);
569 + const approve=document.querySelector('.modal-backdrop:last-of-type [data-action="confirm"]');
570 + check(approve&&approve.textContent.includes('تأیید و ثبت وصول'),
571 + 'Actual bank clearance missing explicit secondary confirmation');
572 + check((await db.get('cheques',cheque.id)).status==='pending'&&
573 + (await db.getAll('journal_entries')).length===journalCount,
574 + 'Cheque cleared before approval');
575 + approve.click();
576 + let cleared;
577 + for(let i=0;i<60;i++){
578 + cleared=await db.get('cheques',cheque.id);
579 + if(cleared?.status==='cleared')break;
580 + await wait(100);
581 + }
582 const journal=await db.get('journal_entries',cleared.statusJournalId);
583 const settlement=(await db.getAll('treasury')).filter(t=>t.refChequeId===cheque.id);
584 + const lines=(await db.getAll('journal_lines')).filter(x=>x.journalId===journal?.id);
585 check(cleared.status==='cleared'&&cleared.dueDate==='1405/07/18'&&
560 - cleared.statusBusinessDate==='1405/07/20'&&
586 + cleared.statusBusinessDate==='1405/07/20'&&cleared.clearingAccountId===secondary.id&&
587 + cleared.clearingApprovedBy===FINORA.Auth.current().id&&
588 journal?.date==='1405/07/20'&&settlement.length===1&&
562 - settlement[0].date==='1405/07/20',
563 - 'Native cheque financial event date not persisted separately from due date');
589 + settlement[0].date==='1405/07/20'&&settlement[0].toAccountId===secondary.id&&
590 + lines.some(x=>x.accountId===secondary.ledgerAccountId&&x.debit===90)&&
591 + !lines.some(x=>x.accountId===active.ledgerAccountId&&x.debit===90),
592 + 'Native cheque clearance failed selected non-default bank accounting');
593 check(!document.querySelector('.toast-error')&&!document.querySelector('.modal-backdrop'),
594 'A05 native treasury scenario left error toast/modal');
595 return { inactiveTransferRejected:true, invalidTransferRolledBack:true,
596 disabledChequeClearingRejected:true, validChequeClearedExactlyOnce:true,
568 - chequeEventDateDifferentFromDueDate:true };
597 + chequeEventDateDifferentFromDueDate:true,
598 + explicitNondefaultClearingAccount:true,confirmationRequiredBeforeCash:true };
599 }
600
601 async function nativeChequeThirdPartyEndorsement() {