forked from bai/curriculum-project-hub
feat(filelib): 操作日志模块——防篡改哈希链、组合查询与 CSV 导出
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -226,10 +226,18 @@ describe("filelib http · 文件冲突流", () => {
|
||||
expect(conflict.statusCode).toBe(409);
|
||||
expect(conflict.json().error.currentVersion).toBe(commit.json().version);
|
||||
|
||||
const audit = await prisma.auditEntry.findFirst({
|
||||
// 冲突事件走事务外旁路(ADR-0039):业务抛了 409,日志仍须存在,
|
||||
// 且带上起始版本与冲突版本。
|
||||
const audit = await prisma.fileLibAuditLog.findFirst({
|
||||
where: { organizationId: DEFAULT_ORG_ID, action: "file.conflict_detected" },
|
||||
});
|
||||
expect(audit).not.toBeNull();
|
||||
expect(audit!.result).toBe("FAILURE");
|
||||
expect(audit!.failureReason).toContain("version_conflict");
|
||||
expect(audit!.context).toMatchObject({
|
||||
baseVersion: v1,
|
||||
currentVersion: commit.json().version,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user