mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 22:00:44 +00:00
Merged via squash.
Prepared head SHA: d34755262f
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Reviewed-by: @velvet-shark
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { DEFAULT_WHATSAPP_SOCKET_TIMING, resolveWhatsAppSocketTiming } from "./socket-timing.js";
|
|
|
|
describe("resolveWhatsAppSocketTiming", () => {
|
|
it("uses OpenClaw's explicit WhatsApp Web socket defaults", () => {
|
|
expect(resolveWhatsAppSocketTiming({})).toEqual(DEFAULT_WHATSAPP_SOCKET_TIMING);
|
|
});
|
|
|
|
it("reads Baileys timing values from web.whatsapp config", () => {
|
|
expect(
|
|
resolveWhatsAppSocketTiming({
|
|
web: {
|
|
whatsapp: {
|
|
keepAliveIntervalMs: 10_000,
|
|
connectTimeoutMs: 90_000,
|
|
defaultQueryTimeoutMs: 120_000,
|
|
},
|
|
},
|
|
}),
|
|
).toEqual({
|
|
keepAliveIntervalMs: 10_000,
|
|
connectTimeoutMs: 90_000,
|
|
defaultQueryTimeoutMs: 120_000,
|
|
});
|
|
});
|
|
|
|
it("lets call-site overrides take precedence over config", () => {
|
|
expect(
|
|
resolveWhatsAppSocketTiming(
|
|
{
|
|
web: {
|
|
whatsapp: {
|
|
keepAliveIntervalMs: 10_000,
|
|
connectTimeoutMs: 90_000,
|
|
defaultQueryTimeoutMs: 120_000,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
keepAliveIntervalMs: 20_000,
|
|
},
|
|
),
|
|
).toEqual({
|
|
keepAliveIntervalMs: 20_000,
|
|
connectTimeoutMs: 90_000,
|
|
defaultQueryTimeoutMs: 120_000,
|
|
});
|
|
});
|
|
});
|