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

test(A02): verify installed Windows opening dry-run remains blocked and read-only

Real NSIS Tauri/WebView2 AccountingView performs JSON dry-run on synthetic historically active company. Shows discrepancy codes, disables posting, writes no journal/settings/audit. Windows Native #38948801630 and PR Quality #38948802003 green. A02 remains unaccepted pending positive historic migration QA.

davoodmehraban89 committed Oct 16, 2026 at 22:15 UTC ebb6fc10f666890941c10d783d87edf2a3b36a50
1 file changed +66 -1
tests/windows-vm-native-functional-matrix.cjs
+66 -1
@@ -408,6 +408,70 @@ async function fiscalCloseGuardrails() {
408 };
409 }
410
411 +async function openingDryRunWithExistingActivity() {
412 + const check = (ok, message) => { if (!ok) throw Error(message); };
413 + const store = FINORA.Storage;
414 + const company = await FINORA.Company.current();
415 + check(company?.id && FINORA.Auth.isAdmin(),
416 + 'Native A02 opening dry-run requires a synthetic administrator');
417 + await FINORA.Router.go('accounting');
418 + const view = window.AccountingView;
419 + check(view, 'AccountingView missing in actual installed app');
420 + await view.switchTab('opening');
421 + const input = document.getElementById('openingFileInput');
422 + const reportHost = document.getElementById('openingPreviewReport');
423 + check(input && reportHost, 'Opening balance JSON dry-run form is missing');
424 + const periods = (await store.getAll('fiscal_periods'))
425 + .filter(x => x.companyId === company.id);
426 + const period = periods.find(x => !x.closed);
427 + check(period, 'An active period is required for A02 blocked historical migration test');
428 + const priorJournals = (await store.getAll('journal_entries'))
429 + .filter(x => x.companyId === company.id && x.status === 'posted');
430 + check(priorJournals.length > 0,
431 + 'Financial activity prerequisite missing: opening must be blocked after posting');
432 + const before = {
433 + entries: (await store.getAll('journal_entries')).length,
434 + lines: (await store.getAll('journal_lines')).length,
435 + events: (await store.getAll('audit_events')).length,
436 + settings: (await store.getAll('settings')).length
437 + };
438 + const fixture = {
439 + periodId: period.id, openingDate: period.startDate,
440 + lines: [], contacts: [], stock: [], cash: []
441 + };
442 + const file = new File([JSON.stringify(fixture)], 'vm-only-a02-opening.json',
443 + { type: 'application/json' });
444 + Object.defineProperty(input, 'files', { configurable: true, value: [file] });
445 + view.resetOpeningPreview();
446 + await view.previewOpeningFile();
447 + const review = view._openingReview;
448 + check(review && review.readiness === 'blocked' && review.writePerformed === false,
449 + 'Native opening dry-run failed to block incompatible historical data');
450 + check(review.issues.includes('EXISTING_POSTED_JOURNALS') &&
451 + review.issues.includes('MISSING_OPENING_JOURNAL_LINES'),
452 + 'Native blocked opening preview omitted journal issues');
453 + check(reportHost.textContent.includes('ثبت مسدود') &&
454 + reportHost.querySelector('button[disabled]'),
455 + 'Native opening UI offered an actionable posting button despite issues');
456 + const after = {
457 + entries: (await store.getAll('journal_entries')).length,
458 + lines: (await store.getAll('journal_lines')).length,
459 + events: (await store.getAll('audit_events')).length,
460 + settings: (await store.getAll('settings')).length
461 + };
462 + check(JSON.stringify(before) === JSON.stringify(after),
463 + 'Opening preview wrote to ledger, audit or settings');
464 + check(!document.querySelector('.toast-error'),
465 + 'Blocked A02 dry-run unexpectedly threw rather than reporting issues');
466 + await view.switchTab('journals');
467 + return {
468 + priorActivityBlocked: true,
469 + discrepancyCodesVisible: true,
470 + commitActionDisabled: true,
471 + zeroWrites: true
472 + };
473 +}
474 +
475 module.exports = async function nativeFunctionalMatrix(cdp) {
476 const phases = [
477 ['activate-accounting-and-inventory', activateAccounting],
@@ -416,7 +480,8 @@ module.exports = async function nativeFunctionalMatrix(cdp) {
480 ['sale-return-immutable-stock-and-ledger', nativeSaleReturnGuardrails],
481 ['backup-and-atomic-rejection', nativeBackupRestore],
482 ['rtl-invoice-print-settings', invoicePrintLayout],
419 - ['fiscal-close-atomic-guardrails', fiscalCloseGuardrails]
483 + ['fiscal-close-atomic-guardrails', fiscalCloseGuardrails],
484 + ['opening-dry-run-rejects-existing-postings', openingDryRunWithExistingActivity]
485 ];
486 const report = {};
487 for (const [name, fn] of phases) {