32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { normalizeAuditExport } from '../src/api/audit';
|
|
import { normalizeReportExport } from '../src/api/reports';
|
|
|
|
describe('reports and governance frontend response contracts', () => {
|
|
it('accepts complete report export confirmations only', () => {
|
|
expect(
|
|
normalizeReportExport({
|
|
exportId: '01HZZZZZZZZZZZZZZZZZZZZZZZ',
|
|
reportCode: 'project-ledger',
|
|
definitionVersion: 'REPORT-DRAFT-V3',
|
|
filterHash: 'a'.repeat(64),
|
|
status: 'COMPLETED',
|
|
estimatedRows: 1,
|
|
rowCount: 1,
|
|
sha256: 'b'.repeat(64),
|
|
fileName: 'report.csv',
|
|
content: 'header\\nvalue',
|
|
}),
|
|
).toMatchObject({ rowCount: 1, fileName: 'report.csv' });
|
|
});
|
|
|
|
it('rejects incomplete report export confirmations before a download can be reported as successful', () => {
|
|
expect(() => normalizeReportExport({ exportId: 'export' } as any)).toThrow('报表导出响应缺少');
|
|
});
|
|
|
|
it('rejects incomplete audit export responses before a download can be reported as successful', () => {
|
|
expect(() => normalizeAuditExport({ exportId: 'export', rowCount: 1 } as any)).toThrow('文件摘要');
|
|
});
|
|
});
|