Files
openclaw/extensions/qa-lab/src/timer-timeouts.test.ts
2026-06-04 21:59:00 -04:00

25 lines
1.0 KiB
TypeScript

// Qa Lab tests cover timer timeouts plugin behavior.
import { MAX_TIMER_TIMEOUT_MS } from "openclaw/plugin-sdk/number-runtime";
import { describe, expect, it } from "vitest";
import { resolveQaGatewayTimeoutWithGraceMs } from "./timer-timeouts.js";
describe("qa timer timeout helpers", () => {
it("adds gateway grace to normal wait timeouts", () => {
expect(resolveQaGatewayTimeoutWithGraceMs(10_000)).toBe(15_000);
expect(resolveQaGatewayTimeoutWithGraceMs(10_000, 500)).toBe(10_500);
});
it("caps oversized gateway wait timeouts", () => {
expect(resolveQaGatewayTimeoutWithGraceMs(Number.MAX_SAFE_INTEGER)).toBe(MAX_TIMER_TIMEOUT_MS);
expect(resolveQaGatewayTimeoutWithGraceMs(MAX_TIMER_TIMEOUT_MS - 100, 500)).toBe(
MAX_TIMER_TIMEOUT_MS,
);
});
it("ignores absent or non-positive wait timeouts", () => {
expect(resolveQaGatewayTimeoutWithGraceMs(undefined)).toBeUndefined();
expect(resolveQaGatewayTimeoutWithGraceMs(0)).toBeUndefined();
expect(resolveQaGatewayTimeoutWithGraceMs(-1)).toBeUndefined();
});
});