refactor(api): centralize timeline read detail schemas
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
buildTimelineEntriesDetailInput,
|
||||
TimelineDetailFiltersSchema,
|
||||
TimelineProjectContextDetailSchema,
|
||||
} from "../router/timeline-read-shared.js";
|
||||
|
||||
describe("timeline read shared", () => {
|
||||
@@ -39,4 +41,32 @@ describe("timeline read shared", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("shares detail filter schemas across timeline read endpoints", () => {
|
||||
expect(TimelineDetailFiltersSchema.parse({
|
||||
startDate: "2026-04-01",
|
||||
durationDays: 14,
|
||||
resourceIds: ["resource_1"],
|
||||
countryCodes: ["DE"],
|
||||
})).toEqual({
|
||||
startDate: "2026-04-01",
|
||||
endDate: undefined,
|
||||
durationDays: 14,
|
||||
resourceIds: ["resource_1"],
|
||||
projectIds: undefined,
|
||||
clientIds: undefined,
|
||||
chapters: undefined,
|
||||
eids: undefined,
|
||||
countryCodes: ["DE"],
|
||||
});
|
||||
|
||||
expect(TimelineProjectContextDetailSchema.parse({
|
||||
projectId: "project_1",
|
||||
endDate: "2026-04-20",
|
||||
})).toEqual({
|
||||
projectId: "project_1",
|
||||
startDate: undefined,
|
||||
endDate: "2026-04-20",
|
||||
durationDays: undefined,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user