Гант: не рисовать зависимости, следующие из цепочки других (транзитивная редукция)
Some checks failed
ci / test (push) Successful in 23s
ci / deploy (push) Has been cancelled

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 13:29:10 +03:00
parent 1a27060706
commit f56c19598d
2 changed files with 35 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { renderPage } from "./html.js";
import { renderAris } from "./aris.js";
import { clampPx, placeLabels, renderGantt, stageOrder, summarizeGroup } from "./gantt.js";
import { clampPx, placeLabels, redundantDependencies, renderGantt, stageOrder, summarizeGroup } from "./gantt.js";
import { buildApi } from "./http-api.js";
import { buildModel, describeResponsible, loadModel, mapRow, type ProcessModel } from "./model.js";
import { computeSchedule, parseConstraint, parseDuration, parseDurationInfo } from "./schedule.js";
@@ -332,6 +332,12 @@ describe("Гант: группы, вехи, свёртывание, масшта
expect(arrows(renderGantt(ms, sch, {}))).toBeGreaterThan(arrows(shut));
});
it("зависимость, следующая из цепочки других, не рисуется стрелкой (A→C при A→B→C)", () => {
const rows = [row({ id: "A" }), row({ id: "B", depends_on: "A" }), row({ id: "C", depends_on: "B", depends_on2: "A" })];
const redundant = redundantDependencies(rows);
expect([...redundant]).toEqual(["A>C"]);
});
it("подпись полосы - название работы (внутри полосы или над ней), id справа снизу, без дат", () => {
const svg = renderGantt(ms, sch, { px: 20 });
expect(svg).toContain('fill="#fff">Работа</text>'); // название внутри длинной полосы