ai-chatbot/tests/routes/openclaw-config.test.ts

36 lines
1.0 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { normalizeOpenClawChatConfig } from "@/lib/openclaw-chat/config";
test.describe("OpenClaw chat configuration", () => {
test("defaults long-running tasks to thirty minutes", () => {
expect(normalizeOpenClawChatConfig({}).timeoutMs).toBe(30 * 60 * 1000);
});
test("allows a thirty-minute timeout for complex skills", () => {
expect(
normalizeOpenClawChatConfig({
enabled: true,
baseUrl: "http://openclaw.test",
token: "secret",
timeoutMs: 30 * 60 * 1000,
}).timeoutMs
).toBe(30 * 60 * 1000);
});
test("caps excessive timeout values at thirty minutes", () => {
expect(
normalizeOpenClawChatConfig({
timeoutMs: 60 * 60 * 1000,
}).timeoutMs
).toBe(30 * 60 * 1000);
});
test("migrates legacy three-minute connection timeout to task lifetime", () => {
expect(
normalizeOpenClawChatConfig({
timeoutMs: 180_000,
}).timeoutMs
).toBe(30 * 60 * 1000);
});
});