Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-10-19 19:36:19 +03:00
parent 170a44c377
commit 5f7bffd6e4
17 changed files with 454 additions and 85 deletions

View File

@@ -58,3 +58,28 @@ test("range=semester: все дни текущего семестра от пе
assert.equal(t.days.at(-1).date, t.semester.end);
assert.ok(t.days.length > 62, "больше обычного предела в 62 дня");
});
test("Сессия с датами в Word не зависит от таблицы недель", () => {
// June 2026 lies outside the 2026/27 week table, yet every lesson has its own date.
const session = parseDocx(fixture("itzs-summer-2026"), { name: "23-ИТзс.docx" });
const t = timetable({
file: { id: "itzs", name: "23-ИТзс.docx" },
schedule: session,
calendar,
group: "23-ИТзс",
from: "2026-10-19",
range: "semester",
today: "2026-10-19",
});
assert.deepEqual(t.semester, {
id: "session-2026-06-08",
label: "Лабораторно-экзаменационная сессия",
start: "2026-06-08",
end: "2026-06-27",
});
assert.equal(t.note, null);
assert.equal(t.days.length, 20);
assert.equal(t.days.reduce((n, d) => n + d.lessons.length, 0), 58);
const exam = t.days.find((d) => d.date === "2026-06-18").lessons.find((l) => l.type === "Экзамен");
assert.deepEqual([exam.start, exam.end, exam.pair], ["08:30", "09:55", 1]);
});