@davoodmehraban89 / Factor-easy / commits / ef796b7
Fork 0

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

Complete analytic applicability behavior coverage

davoodmehraban89 committed Sep 29, 2026 at 22:31 UTC ef796b76f120587d4782577f290092f02393fea1
1 file changed +2
scripts/phase3-behavior-check.mjs
+2
@@ -23,6 +23,8 @@ let invalidDim=false;try{ctx.jeCreateDraft({date:'1405/07/07',description:'inval
23 rules.push({accountId:'rev',dimensionTypeId:'D_PARTY',applicability:'unavailable',active:true});
24 let forbiddenDim=false;try{ctx.jeCreateDraft({date:'1405/07/07',description:'forbidden dim',sourceType:'manual',sourceId:'BAD4',lines:[{accountId:'cash',debit:100,credit:0,dimensions:[]},{accountId:'rev',debit:0,credit:100,dimensions:[{dimensionTypeId:'D_PARTY',dimensionValueId:'CUST1'}]}]})}catch(_){forbiddenDim=true}assert(forbiddenDim,'unavailable analytic dimension must be rejected');
25 let duplicateDim=false;try{ctx.jeCreateDraft({date:'1405/07/07',description:'duplicate dim',sourceType:'manual',sourceId:'BAD5',lines:[{accountId:'ar',debit:100,credit:0,dimensions:[{dimensionTypeId:'D_PARTY',dimensionValueId:'CUST1'},{dimensionTypeId:'D_PARTY',dimensionValueId:'CUST1'}]},{accountId:'rev',debit:0,credit:100,dimensions:[]}]})}catch(_){duplicateDim=true}assert(duplicateDim,'duplicate analytic assignment must be rejected');
26 +rules.push({accountId:'cash',dimensionTypeId:'D_PARTY',applicability:'optional',active:true});assert(ctx.jeValidateDimensions('cash',[])===true,'optional analytic dimension must allow omission');
27 +let unknownDim=false;try{ctx.jeValidateDimensions('cash',[{dimensionTypeId:'UNKNOWN',dimensionValueId:'CUST1'}])}catch(_){unknownDim=true}assert(unknownDim,'undefined analytic dimension must be rejected');
28 const receipt={id:'PAY1',date:'1405/07/07',amount:125000,contactId:'CUST1'};
29 const v=ctx.jePostSourceRecord('receipt',receipt);
30 assert(v.status==='posted','receipt must post');