@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 0440b28
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 18:15 UTC

Add Phase 3 double-entry invariant tests

davoodmehraban89 committed Sep 28, 2026 at 18:24 UTC 0440b280f1a2b9b90f13316874f531125e2ed52b
1 file changed +9
scripts/phase3-check.mjs new
+9
@@ -0,0 +1,9 @@
1 +import fs from 'node:fs';
2 +const e=fs.readFileSync('js/journal-engine.js','utf8'),u=fs.readFileSync('js/journal-ui.js','utf8'),c=fs.readFileSync('js/core.js','utf8'),s=fs.readFileSync('js/sync.js','utf8'),b=fs.readFileSync('js/backup.js','utf8'),i=fs.readFileSync('index.html','utf8');
3 +const need=(src,x,label)=>{for(const n of x)if(!src.includes(n))throw new Error(label+' missing '+n)};
4 +need(e,['jeValidateLines','total debit','jeValidateDimensions','status===\'posted\'','sourceVersion','jeReverse','reversalVoucherId','jeDeleteDraft','jeTrialBalance','journalLineDimensions','paymentMethod===\'credit\'','jeVatPayableAccount'],'engine');
5 +need(u,['view-journal','jeSaveManual','jePostUi','jeReverseUi','je-trial'],'ui');
6 +for(const x of ['postingProfiles','journalVouchers','journalLines','journalLineDimensions']){if(!c.includes("'"+x+"'")||!s.includes(x)||!b.includes(x))throw new Error('persistence missing '+x)}
7 +need(i,['journal-engine.js?v=20260928-phase3-v1','journal-ui.js?v=20260928-phase3-v1'],'index');
8 +if(e.includes('datastore.journalVouchers=datastore.journalVouchers.filter')&&!e.includes("v.status!=='draft'"))throw new Error('posted voucher destructive delete guard missing');
9 +console.log('Phase 3 double-entry invariants passed.');