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

test: verify concurrent autopost requests share a single completion (#216)

davoodmehraban89 committed Nov 18, 2026 at 20:37 UTC 2207cd5baa243ed3f6bacd498b761178dae8884d
1 file changed +3 -2
scripts/journal-rpc-adapter.test.mjs
+3 -2
@@ -337,10 +337,11 @@ test('concurrent source autopost submissions serialize before generic source flu
337 h.context.runSync=async()=>{await gate;return originalRunSync();};
338 const first=h.context.jeRpcAutoPost('sale',h.source.id);
339 await new Promise(resolve=>setImmediate(resolve));
340 - await assert.rejects(()=>h.context.jeRpcAutoPost('sale',h.source.id),/در حال اجراست/);
340 + const second=h.context.jeRpcAutoPost('sale',h.source.id);
341 release();
342 - const voucher=await first;
342 + const [voucher,replayed]=await Promise.all([first,second]);
343 assert.equal(voucher.id,'JV_SERVER_sale');
344 + assert.equal(replayed.id,voucher.id);
345 assert.equal(h.source.journalVoucherId,voucher.id);
346 });
347