tests/integration/mzn.test.js
- import { describe, it, expect, beforeAll } from "vitest";
- import { initSolvers, solveModel } from "../../src/controller/solving.js";
- const SIMPLE_MZN = `
- var 1..5: x;
- constraint x > 3;
- solve satisfy;
- `;
- describe("integration: minizinc", () => {
- beforeAll(async () => {
- await initSolvers();
- }, 30000);
-
- it("solves a trivial satisfy model and returns a solution", async () => {
- const result = await solveModel("test.mzn", SIMPLE_MZN, "gecode");
- expect(["SATISFIED", "OPTIMAL_SOLUTION"]).toContain(result.status);
- expect(result.solution).toBeDefined();
- const x = result.solution.output.json.x;
- expect(x).toBeGreaterThan(3);
- expect(x).toBeLessThanOrEqual(5);
- }, 30000);
- });