R62 Fix A1-A6:请假预览全非工作日处理
这个提交包含在:
@@ -136,6 +136,7 @@ describe("leave working-days route", () => {
|
||||
weekendDayCount: 0,
|
||||
adjustedWorkdayCount: 1,
|
||||
calendarApplied: true,
|
||||
isNonWorkingRange: false,
|
||||
});
|
||||
|
||||
await app.close();
|
||||
@@ -158,6 +159,44 @@ describe("leave working-days route", () => {
|
||||
weekendDayCount: 0,
|
||||
adjustedWorkdayCount: 0.5,
|
||||
calendarApplied: true,
|
||||
isNonWorkingRange: false,
|
||||
});
|
||||
|
||||
await app.close();
|
||||
});
|
||||
|
||||
it("returns zero days instead of error for fully non-working preview ranges", async () => {
|
||||
const { app } = await buildApp({
|
||||
legalEntity: buildLegalEntity({
|
||||
default_holiday_calendar: {
|
||||
id: "calendar-1",
|
||||
archived_at: null,
|
||||
days: [
|
||||
buildCalendarDay("2026-05-01", "holiday"),
|
||||
buildCalendarDay("2026-05-02", "holiday"),
|
||||
buildCalendarDay("2026-05-03", "holiday"),
|
||||
buildCalendarDay("2026-05-04", "holiday"),
|
||||
buildCalendarDay("2026-05-05", "holiday"),
|
||||
],
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
const response = await app.inject({
|
||||
method: "GET",
|
||||
url: "/api/leave-requests/working-days?startDate=2026-05-01&endDate=2026-05-05&startSession=am&endSession=pm",
|
||||
headers: { authorization: "Bearer test" },
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.json().data).toEqual({
|
||||
requestedDays: 0,
|
||||
naturalRequestedDays: 5,
|
||||
holidayDayCount: 5,
|
||||
weekendDayCount: 0,
|
||||
adjustedWorkdayCount: 0,
|
||||
calendarApplied: true,
|
||||
isNonWorkingRange: true,
|
||||
});
|
||||
|
||||
await app.close();
|
||||
@@ -182,6 +221,7 @@ describe("leave working-days route", () => {
|
||||
weekendDayCount: 0,
|
||||
adjustedWorkdayCount: 0,
|
||||
calendarApplied: false,
|
||||
isNonWorkingRange: false,
|
||||
});
|
||||
expect(featureFlagFindUnique).not.toHaveBeenCalled();
|
||||
expect(legalEntityFindUnique).not.toHaveBeenCalled();
|
||||
|
||||
在新工单中引用
屏蔽一个用户