fix: 财务本人报销由总经理独立审批(09-04-reimbursement-state-gap-finance-view)
这个提交包含在:
@@ -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"));
|
||||
|
||||
在新工单中引用
屏蔽一个用户