Publish curated ForgeFlow source from 2ed1787c0b52
ForgeFlow quality gate / quality (push) Successful in 4m12s
ForgeFlow quality gate / secret-scan (push) Successful in 7s

This commit is contained in:
NuklearRabbit committed 2026-09-29 22:50:57 +02:00
commit f60b269686
254 files changed
+46204

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import os from 'node:os';
import path from 'node:path';
import fs from 'node:fs/promises';
import auditModule from '../src/main/audit-service.cjs';
const { AuditService } = auditModule;
test('audit service appends ordered records and exports CSV', async (t) => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'forgeflow-audit-'));
t.after(() => fs.rm(root, { recursive: true, force: true }));
const audit = new AuditService({ userDataPath: root, appInfo: { version: 'test' } });
await Promise.all([
audit.append('deployment.requested', { repository: 'owner/app', sha: 'a'.repeat(40), note: 'Release, wave 1' }),
audit.append('deployment.completed', { repository: 'owner/app', result: 'success' })
]);
const entries = await audit.list();
assert.equal(entries.length, 2);
assert.equal(entries[0].event, 'deployment.completed');
const destination = path.join(root, 'audit.csv');
const result = await audit.exportTo(destination, 'csv');
assert.equal(result.count, 2);
assert.match(await fs.readFile(destination, 'utf8'), /"Release, wave 1"/);
});