test(bluebubbles): split webhook ingress seam

This commit is contained in:
Vincent Koc
2026-04-03 20:57:51 +09:00
parent 2734d06ade
commit 688eb8435b
3 changed files with 15 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ import {
type WebhookTarget,
} from "./monitor-shared.js";
import { fetchBlueBubblesServerInfo } from "./probe.js";
import { getBlueBubblesRuntime } from "./runtime.js";
import {
WEBHOOK_RATE_LIMIT_DEFAULTS,
createFixedWindowRateLimiter,
@@ -24,8 +25,7 @@ import {
resolveRequestClientIp,
resolveWebhookTargetWithAuthOrRejectSync,
withResolvedWebhookRequestPipeline,
} from "./runtime-api.js";
import { getBlueBubblesRuntime } from "./runtime.js";
} from "./webhook-ingress.js";
const webhookTargets = new Map<string, WebhookTarget[]>();
const webhookRateLimiter = createFixedWindowRateLimiter({

View File

@@ -61,8 +61,9 @@ vi.mock("./history.js", () => ({
fetchBlueBubblesHistory: vi.fn().mockResolvedValue({ entries: [], resolved: true }),
}));
vi.mock("./runtime-api.js", async () => {
const actual = await vi.importActual<typeof import("./runtime-api.js")>("./runtime-api.js");
vi.mock("./webhook-ingress.js", async () => {
const actual =
await vi.importActual<typeof import("./webhook-ingress.js")>("./webhook-ingress.js");
return {
...actual,
WEBHOOK_RATE_LIMIT_DEFAULTS: {

View File

@@ -0,0 +1,10 @@
export {
WEBHOOK_RATE_LIMIT_DEFAULTS,
createFixedWindowRateLimiter,
createWebhookInFlightLimiter,
registerWebhookTargetWithPluginRoute,
readWebhookBodyOrReject,
resolveRequestClientIp,
resolveWebhookTargetWithAuthOrRejectSync,
withResolvedWebhookRequestPipeline,
} from "openclaw/plugin-sdk/webhook-ingress";