فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

test(A04): seed actual posted source journal for immutable invoice restore replay

davoodmehraban89 committed Oct 16, 2026 at 18:01 UTC cc1d13c8bda9bee6c99d2aa2a5145dc39f7e1906
1 file changed +6 -1
tests/a04-immutable-posted-restore.test.mjs
+6 -1
@@ -16,9 +16,14 @@ const opts = { companyId, userId, mode: 'replace' };
16
17 test('A04: replace cannot rewrite an already posted invoice or overwrite unrelated records', async () => {
18 await reset();
19 + await StorageService.put('journal_entries', {
20 + id: 'source-sale-1', companyId, status: 'posted',
21 + sourceType: 'invoice', sourceId: 'sale-1'
22 + });
23 const original = {
24 id: 'sale-1', companyId, kind: 'sale', number: '1',
21 - financePosted: true, grandTotal: 1000, paidAmount: 0, remaining: 1000
25 + journalId: 'source-sale-1', financePosted: true,
26 + grandTotal: 1000, paidAmount: 0, remaining: 1000
27 };
28 await StorageService.put('invoices', { ...original });
29 const persisted = await StorageService.get('invoices', original.id);