R62 Fix A1-A6:请假预览全非工作日处理

这个提交包含在:
2026-04-14 12:55:27 +08:00
父节点 f8d941ec64
当前提交 c90cb165be
共修改 7 个文件,包含 114 行新增和 6 行删除
+29
查看文件
@@ -121,6 +121,7 @@ describe("Leave Service", () => {
weekendDayCount: 0,
adjustedWorkdayCount: 1,
calendarApplied: true,
isNonWorkingRange: false,
});
});
@@ -143,6 +144,34 @@ describe("Leave Service", () => {
weekendDayCount: 0,
adjustedWorkdayCount: 0.5,
calendarApplied: true,
isNonWorkingRange: false,
});
});
it("returns zero-day preview for fully non-working ranges when explicitly allowed", () => {
expect(
calculateRequestedDaysPreviewByWorkingCalendar({
startDate: "2026-05-01",
endDate: "2026-05-05",
startSession: "am",
endSession: "pm",
allowNonWorkingRange: true,
calendarDays: [
{ date: "2026-05-01", day_type: "holiday" },
{ date: "2026-05-02", day_type: "holiday" },
{ date: "2026-05-03", day_type: "holiday" },
{ date: "2026-05-04", day_type: "holiday" },
{ date: "2026-05-05", day_type: "holiday" },
],
}),
).toEqual({
requestedDays: 0,
naturalRequestedDays: 5,
holidayDayCount: 5,
weekendDayCount: 0,
adjustedWorkdayCount: 0,
calendarApplied: true,
isNonWorkingRange: true,
});
});
});