Гант: красная черта крайнего срока (не позже, до); веха с крайним сроком стоит на прогнозе по предшественникам
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -175,9 +175,25 @@ describe("computeSchedule", () => {
|
||||
const { timings, warnings, maxDay } = computeSchedule(rows);
|
||||
expect(timings.get("S-1")).toMatchObject({ start: 0, end: 10, kind: "task", fromConstraint: false });
|
||||
expect(timings.get("S-2")).toMatchObject({ start: 10, end: 10, kind: "milestone" });
|
||||
expect(timings.get("CP-1")).toMatchObject({ start: 7, end: 7, approx: true });
|
||||
expect(timings.get("CP-1")).toMatchObject({ start: 10, end: 10, approx: true, deadline: 7 }); // веха на прогнозе, крайний срок отдельно
|
||||
expect(maxDay).toBe(10);
|
||||
expect(warnings).toEqual([{ id: "CP-1", message: expect.stringContaining("раньше окончания предшественников") }]);
|
||||
expect(warnings).toEqual([{ id: "CP-1", message: expect.stringContaining("позже крайнего срока") }]);
|
||||
});
|
||||
|
||||
it("веха с крайним сроком стоит на прогнозе по предшественникам, а крайний срок рисуется красной чертой", () => {
|
||||
const rows = [
|
||||
row({ id: "CP-0", stage: "S", date_constraint: "день 0" }),
|
||||
row({ id: "S-1", stage: "S", depends_on: "CP-0", duration: "5d" }),
|
||||
row({ id: "CP-5", stage: "S", depends_on: "S-1", date_constraint: "не позже дня 75" }),
|
||||
row({ id: "CP-3", stage: "S", depends_on: "CP-0", date_constraint: "около дня 45" }),
|
||||
];
|
||||
const sc = computeSchedule(rows);
|
||||
expect(sc.timings.get("CP-5")).toMatchObject({ start: 5, end: 5, deadline: 75 });
|
||||
expect(sc.timings.get("CP-3")).toMatchObject({ end: 45, deadline: null }); // «около» крайним сроком не считается
|
||||
expect(sc.warnings).toEqual([]);
|
||||
const svg = renderGantt({ ...model, rows }, sc, {});
|
||||
expect(svg.split('stroke="#d32f2f" stroke-width="3"').length - 1).toBe(2); // черта у CP-5 и один знак в легенде
|
||||
expect(svg).toContain("Крайний срок: день 75");
|
||||
});
|
||||
|
||||
it("повторяющиеся шаги тянутся до конца проекта и не считаются предшественниками", () => {
|
||||
|
||||
Reference in New Issue
Block a user