refactor(api): align timeline project read routing
This commit is contained in:
@@ -41,6 +41,7 @@ import {
|
||||
} from "../router/timeline-project-query-support.js";
|
||||
import {
|
||||
readTimelineProjectBudgetStatusResponse,
|
||||
readTimelineProjectShiftPreview,
|
||||
readTimelineProjectShiftPreviewDetail,
|
||||
} from "../router/timeline-project-procedure-support.js";
|
||||
|
||||
@@ -89,6 +90,24 @@ describe("timeline project procedure support", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("loads plain shift preview responses through procedure support", async () => {
|
||||
previewTimelineProjectShiftMock.mockResolvedValueOnce({ valid: true } as never);
|
||||
|
||||
await expect(
|
||||
readTimelineProjectShiftPreview({} as never, {
|
||||
projectId: "project_1",
|
||||
newStartDate: new Date("2026-04-03T00:00:00.000Z"),
|
||||
newEndDate: new Date("2026-04-12T00:00:00.000Z"),
|
||||
}),
|
||||
).resolves.toEqual({ valid: true });
|
||||
|
||||
expect(previewTimelineProjectShiftMock).toHaveBeenCalledWith({}, {
|
||||
projectId: "project_1",
|
||||
newStartDate: new Date("2026-04-03T00:00:00.000Z"),
|
||||
newEndDate: new Date("2026-04-12T00:00:00.000Z"),
|
||||
});
|
||||
});
|
||||
|
||||
it("builds budget status responses from project bookings", async () => {
|
||||
findTimelineProjectOrThrowMock.mockResolvedValueOnce({
|
||||
id: "project_1",
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
buildTimelineEntriesDetailInput,
|
||||
TimelineDetailFiltersSchema,
|
||||
TimelineProjectContextDetailSchema,
|
||||
TimelineProjectIdSchema,
|
||||
} from "../router/timeline-read-shared.js";
|
||||
|
||||
describe("timeline read shared", () => {
|
||||
@@ -68,5 +69,11 @@ describe("timeline read shared", () => {
|
||||
endDate: "2026-04-20",
|
||||
durationDays: undefined,
|
||||
});
|
||||
|
||||
expect(TimelineProjectIdSchema.parse({
|
||||
projectId: "project_1",
|
||||
})).toEqual({
|
||||
projectId: "project_1",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user