فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A03): seed historical audit fixtures through authorized service
davoodmehraban89 committed
Oct 19, 2026 at 18:36 UTC
66ffbe2566e516de332a2d386d1f69e46e056e05
1 file changed
+3
-1
tests/a03-append-only-full-restore.test.mjs
+3
-1
@@ -2,9 +2,11 @@ import test from 'node:test';
2
import assert from 'node:assert/strict';
3
import 'fake-indexeddb/auto';
4
import { StorageService } from '../src/core/StorageService.js';
5
+import { AuditService } from '../src/core/AuditService.js';
6
7
// Seed historical fixtures atomically; standalone history writes are forbidden.
7
-const seedHistory = (store, row) => StorageService.transaction(store, tx => tx.put(store, row));
8
+const seedHistory = (store, row) => StorageService.transaction(store, tx =>
9
+ store === 'audit_events' ? AuditService.restoreHistorical(tx, row) : tx.put(store, row));
10
11
test('A03: full restore refuses to mutate prior audit events and rolls back earlier writes', async () => {
12
await StorageService.clearAll();