سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 00:30 UTC
test: reject direct deletion of source-linked journal drafts (#216)
davoodmehraban89 committed
Nov 18, 2026 at 09:06 UTC
87f910e31ebc3aae070da44d8e867e79380949f4
1 file changed
+8
scripts/journal-rpc-adapter.test.mjs
+8
@@ -351,3 +351,11 @@ test('client fails closed if the server posts a voucher without atomically linki
351
assert.equal(h.source.accountingPostingPending,true);
352
assert.equal(h.source.journalVoucherId,undefined);
353
});
354
+
355
+test('source-linked draft deletion is blocked before any RPC, including manual-labelled links',async()=>{
356
+ for(const fields of [{sourceType:'purchase',sourceId:'P1'},{sourceType:'sale',sourceId:'S1'},{sourceType:'manual',sourceId:'X1'}]){
357
+ const h=harness({vouchers:[{id:'JV_LINK',status:'draft',_serverVersion:7,...fields}]});
358
+ await assert.rejects(()=>h.context.jeRpcDeleteDraft('JV_LINK'),/مدرک منشأ/);
359
+ assert.equal(h.calls.length,0);
360
+ }
361
+});