fix: persistencia dinamica em configs e filtro de tabelas ativas status publish

This commit is contained in:
Andre RDS
2026-11-27 09:00:08 -03:00
parent 9e6c38ff37
commit cc6a77612b
16 changed files with 554 additions and 144 deletions
+17
View File
@@ -158,4 +158,21 @@ describe("SQLite Repositories", () => {
// Mais recente primeiro
expect(new Date(history[0].checked_at).getTime()).toBeGreaterThanOrEqual(new Date(history[1].checked_at).getTime());
});
test("TableRepository: deleteNotIn remove tabelas desativadas/removidas", () => {
const t1: TableInfo = { id: "active-1", title: "Ativo 1", operadora: "Op", administradora: null, revision_date: "Out/2027", download_pdf: null, vigencia: null, produtos_json: null, status: "vigente", extracted_at: null, last_checked: "2026-01-01" };
const t2: TableInfo = { id: "deactivated-2", title: "Desativado 2", operadora: "Op", administradora: null, revision_date: "Out/2026", download_pdf: null, vigencia: null, produtos_json: null, status: "vencida", extracted_at: null, last_checked: "2026-01-01" };
tableRepo.save(t1);
tableRepo.save(t2);
expect(tableRepo.getAll().length).toBe(2);
// Sync do CMS traz apenas active-1
const deletedCount = tableRepo.deleteNotIn(["active-1"]);
expect(deletedCount).toBe(1);
const remaining = tableRepo.getAll();
expect(remaining.length).toBe(1);
expect(remaining[0].id).toBe("active-1");
});
});