mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-24 23:43:03 +00:00
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { OpenClawConfig } from "../../../config/types.openclaw.js";
|
|
import { resolveQueueSettings } from "./settings.js";
|
|
|
|
describe("resolveQueueSettings", () => {
|
|
it("defaults inbound channels to steer with a short followup debounce", () => {
|
|
expect(resolveQueueSettings({ cfg: {} as OpenClawConfig })).toEqual({
|
|
mode: "steer",
|
|
debounceMs: 500,
|
|
cap: 20,
|
|
dropPolicy: "summarize",
|
|
});
|
|
});
|
|
|
|
it("uses the short debounce when collect is selected globally", () => {
|
|
expect(
|
|
resolveQueueSettings({
|
|
cfg: {
|
|
messages: {
|
|
queue: {
|
|
mode: "collect",
|
|
},
|
|
},
|
|
} as OpenClawConfig,
|
|
}),
|
|
).toEqual({
|
|
mode: "collect",
|
|
debounceMs: 500,
|
|
cap: 20,
|
|
dropPolicy: "summarize",
|
|
});
|
|
});
|
|
|
|
it("keeps explicit channel queue overrides ahead of defaults", () => {
|
|
expect(
|
|
resolveQueueSettings({
|
|
cfg: {
|
|
messages: {
|
|
queue: {
|
|
mode: "steer",
|
|
debounceMs: 750,
|
|
byChannel: {
|
|
discord: "collect",
|
|
},
|
|
},
|
|
},
|
|
} as OpenClawConfig,
|
|
channel: "discord",
|
|
}),
|
|
).toEqual({
|
|
mode: "collect",
|
|
debounceMs: 750,
|
|
cap: 20,
|
|
dropPolicy: "summarize",
|
|
});
|
|
});
|
|
|
|
it("keeps legacy queue mode distinct from steer", () => {
|
|
const settings = resolveQueueSettings({
|
|
cfg: {
|
|
messages: {
|
|
queue: {
|
|
mode: "queue",
|
|
},
|
|
},
|
|
} as OpenClawConfig,
|
|
});
|
|
expect(settings.mode).toBe("queue");
|
|
});
|
|
});
|