Files
SystemSimulationApp/frontend/tests/e2e/simulation-timeout.spec.ts
T

22 lines
883 B
TypeScript

import { expect, test } from "@playwright/test";
import {
SIMULATION_SOLVER_STALL_TIMEOUT_MINUTES,
SIMULATION_SOLVER_STALL_TIMEOUT_MS,
solverStallTimeoutMessage,
solverStallTimeoutReached,
} from "../../src/simulationTimeout";
test("solver stall watchdog allows the validated long-running window", () => {
expect(SIMULATION_SOLVER_STALL_TIMEOUT_MINUTES).toBe(15);
expect(SIMULATION_SOLVER_STALL_TIMEOUT_MS).toBe(900_000);
expect(solverStallTimeoutReached(1_000, 900_999)).toBe(false);
expect(solverStallTimeoutReached(1_000, 901_000)).toBe(true);
});
test("solver stall messages use the configured duration", () => {
expect(solverStallTimeoutMessage("detected")).toContain("连续 15 分钟");
expect(solverStallTimeoutMessage("recovering")).toContain("连续 15 分钟");
expect(solverStallTimeoutMessage("recovering")).toContain("恢复部分结果");
});