feat(admin): 增加审计与一致性页面

This commit is contained in:
2026-07-08 17:05:16 +08:00
parent ea0b631a83
commit 988d659fcc
9 changed files with 482 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { summarizeConsistencyResult, type ConsistencyResult } from './consistency-api';
test('summarizeConsistencyResult counts ok warn and error checks', () => {
const result: ConsistencyResult = {
generatedAt: '2026-07-08T08:00:00.000Z',
status: 'fail',
counts: { products: 1 },
checks: {
partitionKeys: [{ id: 'p', label: 'p', severity: 'ok', count: 0, message: 'ok' }],
orphanReferences: [{ id: 'o', label: 'o', severity: 'error', count: 2, message: 'bad' }],
auditCoverage: [{ id: 'a', label: 'a', severity: 'warn', count: 0, message: 'missing' }],
},
summary: { errors: 1, warnings: 1, human: 'summary' },
};
assert.deepEqual(summarizeConsistencyResult(result), {
ok: 1,
warn: 1,
error: 1,
total: 3,
});
});