فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A03): reject direct forged audit and correction records
davoodmehraban89 committed
Oct 19, 2026 at 11:26 UTC
9bd5c5f0ac54ccf142c03d637cd5fd29aa96ef04
1 file changed
+11
tests/a03-audit-integration.test.mjs
+11
@@ -182,3 +182,14 @@ test('A04: immutable company audit replay ignores JSON property ordering but rej
182
/بازنویسی سابقه/);
183
assert.equal((await StorageService.get('audit_events', original.id)).sourceId, original.sourceId);
184
});
185
+
186
+test('A03: standalone storage cannot forge audit or correction history', async () => {
187
+ await setup();
188
+ const before = await AuditService.list();
189
+ for (const store of ['audit_events', 'document_corrections']) {
190
+ const forged = { id: `forged-${store}`, companyId: company, eventType: 'journal_posted' };
191
+ await assert.rejects(StorageService.put(store, forged), /ثبت مستقیم سابقه/);
192
+ assert.equal(await StorageService.get(store, forged.id), undefined);
193
+ }
194
+ assert.deepEqual(await AuditService.list(), before);
195
+});