import assert from "node:assert/strict"; import test from "node:test"; import { Op } from "sequelize"; import { Criteria } from "./critera"; import { CriteriaToSequelizeConverter } from "./criteria-to-sequelize-converter"; test("mantiene operadores de rango al reconstruir criterios serializados", () => { const criteria = Criteria.fromPrimitives( [ { field: "proforma_date", operator: "GREATER_THAN_OR_EQUAL", value: "2026-01-01", }, { field: "proforma_date", operator: "LOWER_THAN_OR_EQUAL", value: "2026-08-29", }, ], "proforma_date", "DESC", 50, 0 ); const options = new CriteriaToSequelizeConverter().convert(criteria, { sortableFields: ["proforma_date"], }); const where = options.where as { [Op.and]: Array>> }; assert.deepEqual(where[Op.and], [ { proforma_date: { [Op.gte]: "2026-01-01" } }, { proforma_date: { [Op.lte]: "2026-08-29" } }, ]); });