diff --git a/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts b/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts new file mode 100644 index 00000000000..720015c7f89 --- /dev/null +++ b/src/plugin-sdk/test-helpers/plugin-runtime-mock.test.ts @@ -0,0 +1,16 @@ +import { createPluginRuntimeMock } from "openclaw/plugin-sdk/channel-test-helpers"; +import { describe, expect, it, vi } from "vitest"; + +describe("createPluginRuntimeMock", () => { + it("keeps the inbound debouncer mock aligned with the runtime contract", () => { + const runtime = createPluginRuntimeMock(); + const debouncer = runtime.channel.debounce.createInboundDebouncer({ + debounceMs: 0, + buildKey: () => "key", + onFlush: vi.fn(), + }); + + expect(debouncer.cancelKey("key")).toBe(false); + expect(vi.isMockFunction(debouncer.cancelKey)).toBe(true); + }); +}); diff --git a/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts b/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts index e300e1a4148..5d51449ed87 100644 --- a/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts +++ b/src/plugin-sdk/test-helpers/plugin-runtime-mock.ts @@ -605,6 +605,7 @@ export function createPluginRuntimeMock(overrides: DeepPartial = await params.onFlush([item]); }, flushKey: vi.fn(), + cancelKey: vi.fn(() => false), }), ) as unknown as PluginRuntime["channel"]["debounce"]["createInboundDebouncer"], resolveInboundDebounceMs: vi.fn((params: unknown) => {