سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 00:30 UTC
test: assert invoice corrections use server reversal RPC
davoodmehraban89 committed
Nov 17, 2026 at 21:57 UTC
d74bab87c39c471d9ba093da5861b5c597e7cf1f
1 file changed
+2
scripts/accounting-document-workflow.spec.js
+2
@@ -316,6 +316,7 @@ test('posted sale can be returned to an editable corrective draft; original vouc
316
const before=remoteInvoices(server)[0],originalVoucherId=before.journalVoucherId;
317
const originalLines=[...server.records.values()].filter(x=>x.collection==='journalLines'&&x.data.voucherId===originalVoucherId).map(copy);
318
const result=await page.evaluate(id=>reopenPostedInvoiceAsDraft(id,'تصحیح تعداد پایلوت'),originalId);
319
+ expect(server.reverseCount).toBe(1);
320
expect(result).toBeTruthy();expect(result).not.toBe(originalId);
321
await expect.poll(()=>remoteInvoices(server).length,{timeout:13000}).toBe(2);
322
const after=remoteInvoices(server),original=after.find(i=>i.id===originalId),draft=after.find(i=>i.id===result);
@@ -402,6 +403,7 @@ test('pilot cancellation preserves posted invoice record while only unposted dra
403
const blocked=await page.evaluate(id=>{try{deleteInvoicePilotDraft(id);return 'unexpected'}catch(e){return String(e.message)}},invoiceId);
404
expect(blocked).not.toBe('unexpected');
405
await page.evaluate(id=>cancelPostedInvoicePilot(id,'ابطال سند پایلوت'),invoiceId);
406
+ expect(server.reverseCount).toBe(1);
407
await expect.poll(()=>[...server.records.values()].filter(x=>x.collection==='journalVouchers').length,{timeout:13000}).toBe(2);
408
expect(remoteInvoices(server)[0].id).toBe(invoiceId);
409
expect(remoteInvoices(server)[0].grandTotal).toBe(original.grandTotal);