Employee Activity: итог «Всего» как «Понедельно» на одном дне, серая доля чата, действия агента засчитываются менеджеру
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,26 @@ describe("графики", () => {
|
||||
expect(svg).toContain(`fill="${COLORS.yellow}"`);
|
||||
expect(svg).toContain(`width="${2 * CELL}"`); // та же ширина дня, что у графиков людей
|
||||
});
|
||||
|
||||
it("итог за день: колонка всегда высотой во всех людей, зелёное внизу, жёлтое выше, красное сверху", () => {
|
||||
const totals = [{ date: "2026-10-12", green: 1, yellow: 1, red: 1, off: 0, black: 0 }, { date: "2026-10-13", green: 0, yellow: 0, red: 3, off: 0, black: 0 }];
|
||||
const svg = renderTotalChart(totals, 3);
|
||||
const rects = (color: string) => [...svg.matchAll(new RegExp(`<rect x="(\\d+)" y="([\\d.]+)" width="14" height="([\\d.]+)" fill="${color}"`, "g"))].map((m) => ({ x: Number(m[1]), y: Number(m[2]), h: Number(m[3]) }));
|
||||
const g = rects(COLORS.green)[0]!, y = rects(COLORS.yellow)[0]!, r = rects(COLORS.red);
|
||||
expect(g.y).toBeGreaterThan(y.y); // зелёное ниже жёлтого
|
||||
expect(y.y).toBeGreaterThan(r[0]!.y); // жёлтое ниже красного
|
||||
expect(g.h + y.h + r[0]!.h).toBeCloseTo(r[1]!.h); // первый день равен по высоте дню из одних красных
|
||||
expect(r[1]!.y).toBeCloseTo(r[0]!.y); // верх у обеих колонок один
|
||||
});
|
||||
|
||||
it("серая доля сообщений в чате внутри белого столбика", () => {
|
||||
const series = buildSeries({ from: "2026-10-12", to: "2026-10-12", counts: new Map([["2026-10-12", counts({ chat: 2, todo_closed: 2 })]]), nonWorkdays: new Set<string>(), threshold: 1 });
|
||||
const svg = renderPersonChart(series, 1, 4);
|
||||
const grey = [...svg.matchAll(/fill="#cfd4dc"/g)].length;
|
||||
expect(grey).toBe(1);
|
||||
const noChat = renderPersonChart(buildSeries({ from: "2026-10-12", to: "2026-10-12", counts: new Map([["2026-10-12", counts({ todo_closed: 2 })]]), nonWorkdays: new Set<string>(), threshold: 1 }), 1, 4);
|
||||
expect(noChat).not.toContain("#cfd4dc");
|
||||
});
|
||||
});
|
||||
|
||||
describe("чёрная неделя и понедельные столбики", () => {
|
||||
@@ -214,7 +234,7 @@ describe("страница Employee Activity", () => {
|
||||
expect(r.body.match(/class="chart"/g)).toHaveLength(4); // два человека, итоговый график и понедельная строка
|
||||
expect(r.body).toContain("Понедельно");
|
||||
expect(r.body.indexOf("Greg Paris")).toBeLessThan(r.body.indexOf("Всего")); // итог под всеми людьми
|
||||
expect(r.body).toContain("зелёные (внизу) + жёлтые");
|
||||
expect(r.body).toContain("колонка = все люди: зелёные (внизу), жёлтые, красные (вверху)");
|
||||
expect(r.body).toContain("зелёный день: есть Daily Log");
|
||||
expect(r.body).toContain("события JobTread загружены 2026-10-15 09:50 UTC");
|
||||
expect(r.body.match(/<rect x="\d+" y="0" width="18" height="48"/g)).toHaveLength(28); // 2 человека x 14 дней
|
||||
|
||||
Reference in New Issue
Block a user