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

test(A05): verify cheque discrepancy report through installed Windows UI

davoodmehraban89 committed Oct 17, 2026 at 00:34 UTC 541770fe4d95e374aa8dec5682a68d4fe8e2c39f
1 file changed +41
tests/windows-vm-native-functional-matrix.cjs
+41
@@ -559,6 +559,46 @@ async function nativeInactiveBankSettlementGuard() {
559 disabledChequeClearingRejected:true, validChequeClearedExactlyOnce:true };
560 }
561
562 +async function nativeTreasuryChequeReconciliation() {
563 + const wait=ms=>new Promise(resolve=>setTimeout(resolve,ms));
564 + const check=(ok,msg)=>{if(!ok)throw Error(msg);};
565 + const storage=FINORA.Storage,company=await FINORA.Company.current();
566 + check(company?.id&&FINORA.Auth.isAdmin(),'A05 reconciliation requires synthetic admin');
567 + await FINORA.Router.go('accounting');await wait(130);
568 + const view=window.AccountingView;
569 + await view.switchTab('reconciliation');
570 + const original=await view.renderReconciliation();
571 + check(original.includes('چک‌های مالی'),'Native reconciliation does not show cheque controls');
572 + check(!original.includes('CHEQUE_SOURCE_JOURNAL_MISSING')&&
573 + !original.includes('CHEQUE_CLEARING_CASH_COUNT'),
574 + 'Real posted VM cheque failed reconciliation before fault injection');
575 + // Corrupt only a synthetic fixture in the disposable native VM, never
576 + // alter a customer accounting record. This probes read-only detection.
577 + const id='vm-a05-invalid-cheque-reconciliation';
578 + const broken={id,companyId:company.id,financePosted:true,
579 + direction:'inbound',status:'cleared',amount:90,journalId:'not-there',
580 + statusJournalId:'not-there-either'};
581 + await storage.put('cheques',broken);
582 + const before=(await storage.getAll('journal_entries')).length;
583 + const checked=await view.renderReconciliation();
584 + check(checked.includes('CHEQUE_SOURCE_JOURNAL_MISSING')&&
585 + checked.includes('CHEQUE_STATUS_JOURNAL_MISSING')&&
586 + checked.includes('CHEQUE_CLEARING_CASH_COUNT'),
587 + 'Native installed reconciliation failed to report malformed cheque');
588 + check((await storage.getAll('journal_entries')).length===before&&
589 + (await storage.get('cheques',id))?.status==='cleared',
590 + 'Read-only reconciliation changed journal or cheque state');
591 + await storage.delete('cheques',id);
592 + const after=await view.renderReconciliation();
593 + check(!after.includes('CHEQUE_SOURCE_JOURNAL_MISSING')&&
594 + !after.includes('CHEQUE_CLEARING_CASH_COUNT'),
595 + 'Reconciliation still reports synthetic cheque after fixture removal');
596 + await view.switchTab('journals');
597 + check(!document.querySelector('.toast-error'),'A05 reconciliation left toast');
598 + return {livePostedChequeReviewed:true,chequeDiscrepanciesDetected:true,
599 + reportingReadOnly:true,fixtureRemoved:true};
600 +}
601 +
602 async function nativeBackupRestore() {
603 const check = (value, message) => { if (!value) throw Error(message); };
604 const S = FINORA.Storage;
@@ -821,6 +861,7 @@ module.exports = async function nativeFunctionalMatrix(cdp) {
861 ['purchase-and-post-ledger', purchaseInvoice],
862 ['partial-sale-and-inventory', saleInvoice],
863 ['inactive-treasury-cheque-settlement', nativeInactiveBankSettlementGuard],
864 + ['treasury-cheque-reconciliation-readonly', nativeTreasuryChequeReconciliation],
865 ['sale-return-immutable-stock-and-ledger', nativeSaleReturnGuardrails],
866 ['purchase-return-and-stock-guardrails', nativePurchaseReturnGuardrails],
867 ['append-only-history-bulk-clear-protection', nativeHistoryClearFailClosed],