@davoodmehraban89 / Factor-easy / commits / 1f46af6
Fork 0

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

test: protect source-linked and reversal drafts from manual edits (#216)

davoodmehraban89 committed Nov 18, 2026 at 09:27 UTC 1f46af65d2ff4a676d6fc7fe57d7b2793b6c9151
1 file changed +8
scripts/journal-rpc-adapter.test.mjs
+8
@@ -359,3 +359,11 @@ test('source-linked draft deletion is blocked before any RPC, including manual-l
359 assert.equal(h.calls.length,0);
360 }
361 });
362 +
363 +test('source-linked or reversal drafts cannot use the manual edit RPC',async()=>{
364 + for(const fields of [{sourceType:'sale',sourceId:'S1'},{sourceType:'manual',sourceId:'X1'},{sourceType:'manual',voucherType:'reversal'}]){
365 + const h=harness({vouchers:[{id:'JV_LINK',status:'draft',_serverVersion:7,...fields}]});
366 + await assert.rejects(()=>h.context.jeRpcUpdateDraft('JV_LINK',{}),/بدون مدرک منشأ/);
367 + assert.equal(h.calls.length,0);
368 + }
369 +});