File size: 1,476 Bytes
4440aec | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | // Tests runtime queue settings with mocked provider fallback state.
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../config/types.openclaw.js";
const getLoadedChannelPluginMock = vi.hoisted(() => vi.fn());
vi.mock("../../../channels/plugins/index.js", () => ({
getLoadedChannelPlugin: getLoadedChannelPluginMock,
}));
describe("resolveQueueSettings runtime defaults", () => {
it("uses defaults from already-loaded channel plugins", async () => {
getLoadedChannelPluginMock.mockReturnValueOnce({
defaults: {
queue: {
debounceMs: 125,
},
},
});
const { resolveQueueSettings } = await import("./settings-runtime.js");
expect(resolveQueueSettings({ cfg: {} as OpenClawConfig, channel: "demo" })).toEqual({
mode: "steer",
debounceMs: 125,
cap: 20,
dropPolicy: "summarize",
});
expect(getLoadedChannelPluginMock).toHaveBeenCalledWith("demo");
});
it("falls back without loading bundled channel plugins", async () => {
getLoadedChannelPluginMock.mockReturnValueOnce(undefined);
const { resolveQueueSettings } = await import("./settings-runtime.js");
expect(resolveQueueSettings({ cfg: {} as OpenClawConfig, channel: "telegram" })).toEqual({
mode: "steer",
debounceMs: 500,
cap: 20,
dropPolicy: "summarize",
});
expect(getLoadedChannelPluginMock).toHaveBeenCalledWith("telegram");
});
});
|