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

test: reject corrective reopen after cancellation while preserving immutable history (#216)

davoodmehraban89 committed Nov 18, 2026 at 21:24 UTC 4e8081e5c23df7970f7626b537096e84cbc81ba8
1 file changed +3 -2
scripts/accounting-document-workflow.spec.js
+3 -2
@@ -449,8 +449,9 @@ test('pilot cancellation preserves posted invoice record while only unposted dra
449 const status=await page.evaluate(id=>invoiceDocumentStatus(getMyInvoices().find(x=>x.id===id)),invoiceId);
450 expect(status).toBe('reversed');
451 const bad=await page.evaluate(async id=>{try{await reopenPostedInvoiceAsDraft(id,'تکرار');return 'unexpected'}catch(e){return String(e.message)}},invoiceId);
452 - expect(bad).toBe('unexpected');
453 - expect(server.reverseCount).toBe(1);
452 + expect(bad).not.toBe('unexpected');
453 + expect(bad).toMatch(/ابطال|اصلاحیه/);
454 + expect(server.reverseCount).toBe(1);
455 // A separate never-posted invoice may be deleted; posted history stays intact.
456 await fillInvoice(page,'PILOT-DELETE-DRAFT-001',1);await page.evaluate(()=>commitSaveInvoice());
457 await expect.poll(()=>remoteInvoices(server).length,{timeout:13000}).toBe(2);