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

test(A03): deny direct historical restore outside authorized transaction

davoodmehraban89 committed Oct 19, 2026 at 18:43 UTC 3d95b61151c08643d378b278ffaec35a19746fb3
1 file changed +11
tests/a03-audit-integration.test.mjs
+11
@@ -261,3 +261,14 @@ test('A03: direct audit mutation APIs reject forged records and roll back writes
261 assert.equal(await StorageService.get('audit_events', id), undefined);
262 }
263 });
264 +
265 +
266 +test('A03: direct historical restore without authorization is rejected', async () => {
267 + await setup();
268 + await assert.rejects(StorageService.transaction('audit_events', tx =>
269 + AuditService.restoreHistorical(tx, {
270 + id: 'forged-restore', companyId: company, actorId: 'audit-admin',
271 + eventType: 'journal_posted', sourceId: 'forged', commandKey: 'forged'
272 + })), /بازیابی مستقیم ممیزی/);
273 + assert.equal(await StorageService.get('audit_events', 'forged-restore'), undefined);
274 +});