完成五人团队正式内用最小收口(07-18-small-team-internal-readiness)

这个提交包含在:
2026-07-18 15:46:14 +08:00
父节点 58c8decef9
当前提交 5d0a5f9a38
共修改 134 个文件,包含 10790 行新增和 1413 行删除
@@ -327,7 +327,8 @@ describe("reimbursement attachment routes", () => {
const deleteResponse = await app.inject({
method: "DELETE",
url: `/api/reimbursements/${reimbursementId}/attachments/${attachmentId}`,
headers: { authorization: "Bearer test" },
headers: { authorization: "Bearer test", "content-type": "application/json" },
payload: { reason: "重复上传" },
});
expect(deleteResponse.statusCode).toBe(200);
@@ -341,10 +342,40 @@ describe("reimbursement attachment routes", () => {
reimbursement_id: reimbursementId,
},
});
expect(prisma.auditLog.create).toHaveBeenLastCalledWith(
expect.objectContaining({
data: expect.objectContaining({
action: "REIMBURSEMENT_ATTACHMENT_DELETED",
target_id: attachmentId,
extra: expect.objectContaining({ reimbursementId, reason: "重复上传" }),
}),
}),
);
expect(createdAttachments).toHaveLength(0);
} finally {
await app.close();
await fs.rm(tempDir, { recursive: true, force: true });
}
});
it("rejects attachment deletion without a meaningful reason before mutation", async () => {
const { app, prisma, tempDir, reimbursementId } = await buildApp();
try {
const response = await app.inject({
method: "DELETE",
url: `/api/reimbursements/${reimbursementId}/attachments/bbbbbbbb-bbbb-4bbb-8bbb-000000000001`,
headers: { authorization: "Bearer test", "content-type": "application/json" },
payload: { reason: " " },
});
expect(response.statusCode).toBe(400);
expect(response.json().error.code).toBe("VALID_001");
expect(prisma.reimbursementAttachment.deleteMany).not.toHaveBeenCalled();
expect(prisma.auditLog.create).not.toHaveBeenCalled();
} finally {
await app.close();
await fs.rm(tempDir, { recursive: true, force: true });
}
});
});