mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
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");
|
|
});
|
|
});
|