Files
millionco__react-doctor/packages/evals/tests/get-evaluation-timeout-seconds.test.ts
Aiden Bai 3598138c7b Scale eval corpus and tighten diagnostics (#1403)
* scale eval corpus and tighten diagnostics

* fix review and Windows eval failures
2026-07-19 04:13:13 -07:00

36 lines
1007 B
TypeScript

import { describe, expect, it } from "vite-plus/test";
import { getEvaluationTimeoutSeconds } from "../src/utils/get-evaluation-timeout-seconds.js";
describe("getEvaluationTimeoutSeconds", () => {
it("bounds a command timeout by the remaining evaluation budget", () => {
expect(
getEvaluationTimeoutSeconds({
deadlineMilliseconds: 11_000,
maximumTimeoutSeconds: 30,
nowMilliseconds: 1_000,
}),
).toBe(10);
});
it("keeps the command-specific timeout when the budget is larger", () => {
expect(
getEvaluationTimeoutSeconds({
deadlineMilliseconds: 61_000,
maximumTimeoutSeconds: 5,
nowMilliseconds: 1_000,
}),
).toBe(5);
});
it("rejects new work after the evaluation budget is exhausted", () => {
expect(() =>
getEvaluationTimeoutSeconds({
deadlineMilliseconds: 1_000,
maximumTimeoutSeconds: 5,
nowMilliseconds: 1_000,
}),
).toThrow("budget exhausted");
});
});