feat: Update API versioning and parser handling for improved schedule updates and error management

This commit is contained in:
2026-10-19 23:29:35 +03:00
parent 85c5baa3e5
commit 68f9b95090
10 changed files with 32 additions and 18 deletions

View File

@@ -99,6 +99,7 @@ test("API: ошибки с машиночитаемым кодом", async () =>
test("API: исходный документ, сбой и таймаут университета", async () => {
const catalog = (await json("/api/catalog")).body;
assert.equal(typeof catalog.parserVersion, "number");
const id = (name) => catalog.files.find((f) => f.name === name).id;
const original = await get(`/api/original/${id("23-ЛГ_23-БА.docx")}`);
assert.equal(original.status, 200);

View File

@@ -156,6 +156,12 @@ test("Обновления: тот же файл перечитывается,
scheduleUpdate({ ...saved, schemaVersion: 4 }, { files: [base] }, "23-БА", options).changed,
base,
);
// Without options the server's parser version from the catalog decides; an old server
// without it never triggers a re-read.
const parsed11 = { ...saved, schemaVersion: 11 };
assert.equal(scheduleUpdate(parsed11, { files: [base], parserVersion: 12 }, "23-БА").changed, base);
assert.equal(scheduleUpdate(parsed11, { files: [base], parserVersion: 11 }, "23-БА"), null);
assert.equal(scheduleUpdate(parsed11, { files: [base] }, "23-БА"), null);
const spring = file("b", "23-БА весна.docx", "Mon, 25 Jan 2027 09:00:00 GMT");
const others = [
file("c", "23-БАз.docx", "Mon, 25 Jan 2027 09:00:00 GMT"),