فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(A03): add positive protection tests before closing audit bypass
davoodmehraban89 committed
Oct 19, 2026 at 18:33 UTC
4165c5c1cbec0fb4cb8015d1a7bbc1a647ae454d
1 file changed
+23
tests/a03-audit-integration.test.mjs
+23
@@ -222,3 +222,26 @@ test('A03: valid audit date is retained and cannot be overwritten', async () =>
222
await assert.rejects(StorageService.transaction('audit_events', tx => AuditService.append(tx, event)));
223
assert.equal((await AuditService.list()).filter(x => x.sourceId === commandKey).length, 1);
224
});
225
+
226
+test('A03 guard: ordinary audited journal remains atomic', async () => {
227
+ const state = await setup();
228
+ const before = (await AuditService.list()).length;
229
+ const posted = await AccountingService.postJournal(journal(state));
230
+ assert.equal((await StorageService.get('journal_entries', posted.id)).status, 'posted');
231
+ assert.equal((await AuditService.list()).length, before + 1);
232
+});
233
+
234
+test('A03 guard: company backup round trip preserves historical audit', async () => {
235
+ await setup();
236
+ const backup = await SettingsController.exportBackup();
237
+ const before = (await AuditService.list()).length;
238
+ await SettingsController.importBackup(backup);
239
+ assert.equal((await AuditService.list()).length, before + 1);
240
+});
241
+
242
+test('A03 guard: full backup replay of identical audit is accepted', async () => {
243
+ await setup();
244
+ const snapshot = await StorageService.exportAll();
245
+ await StorageService.importAll(snapshot);
246
+ assert.ok((await AuditService.list()).length >= 1);
247
+});