fix: 财务本人报销由总经理独立审批(09-04-reimbursement-state-gap-finance-view)
ci-e2e / e2e (push) Canceled after 0s
ci-minimal / check-minimal (push) Canceled after 0s

这个提交包含在:
2026-09-12 20:03:29 +08:00
父节点 31ab9fbb2b
当前提交 229867f5fd
共修改 18 个文件,包含 629 行新增和 20 行删除
@@ -6,9 +6,15 @@ const REIMBURSEMENT_ID = "11111111-1111-4111-8111-111111111111";
function buildTx() {
return {
employee: {
findUnique: vi.fn(async () => ({ roles: [{ role_code: "employee" }] })),
},
employeeRole: { findFirst: vi.fn(async () => null) },
reimbursementForm: {
findUnique: vi.fn(async () => ({
id: REIMBURSEMENT_ID,
owner_id: REIMBURSEMENT_ID,
submitter_id: REIMBURSEMENT_ID,
items: [
{
id: "item-office",
@@ -37,6 +43,21 @@ function buildTx() {
}
describe("buildReimbursementOperationalChecks", () => {
it("reports missing CEO as an operational blocker independently of the budget feature", async () => {
const tx = buildTx();
tx.employee.findUnique.mockResolvedValue({ roles: [{ role_code: "finance" }] });
const result = await buildReimbursementOperationalChecks(tx, {
reimbursementId: REIMBURSEMENT_ID, config: { appTimezone: "Asia/Shanghai" },
});
expect(result.blockingReasons).toEqual([expect.objectContaining({ code: "finance_owner_ceo_unavailable" })]);
expect(tx.employeeRole.findFirst).toHaveBeenCalledWith(expect.objectContaining({
where: {
role_code: "ceo", employee_id: { notIn: [REIMBURSEMENT_ID] },
employee: { status: "active", archived_at: null },
},
}));
});
beforeEach(() => {
vi.useFakeTimers();
vi.setSystemTime(new Date("2026-08-04T04:00:00.000Z"));