mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
ac28f4d558
* fix(channels): consolidate delivery lifecycle ownership * test(msteams): match release mock contract * test(plugin-sdk): satisfy promise executor lint * chore(plugin-sdk): regenerate API baseline for delivery-correlation + fetch-runtime exports
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { expect, it, vi } from "vitest";
|
|
import {
|
|
createChannelMessageReplyPipeline,
|
|
createContext,
|
|
createRuntime,
|
|
createStatusReactionController,
|
|
describeTelegramDispatch,
|
|
dispatchWithContext,
|
|
} from "./bot-message-dispatch.test-harness.js";
|
|
import type { TelegramMessageContext } from "./bot-message-dispatch.test-harness.js";
|
|
import { telegramInboundEventDelivery } from "./inbound-event-delivery.js";
|
|
|
|
describeTelegramDispatch("dispatchTelegramMessage pipeline-init", () => {
|
|
it("keeps Telegram typing below its client expiry without a per-message cutoff", async () => {
|
|
await dispatchWithContext({ context: createContext() });
|
|
|
|
expect(createChannelMessageReplyPipeline).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
typing: expect.objectContaining({
|
|
keepaliveIntervalMs: 4_000,
|
|
maxDurationMs: 0,
|
|
}),
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("cleans delivery correlation when reply-pipeline initialization fails", async () => {
|
|
const sessionKey = "agent:main:telegram:direct:pipeline-init-failure";
|
|
const statusReactionController = createStatusReactionController();
|
|
const reactionApi = vi.fn(async () => undefined);
|
|
const runtime = createRuntime();
|
|
runtime.error = vi.fn(() => {
|
|
telegramInboundEventDelivery.notify({
|
|
sessionKey,
|
|
to: "123",
|
|
accountId: "default",
|
|
});
|
|
});
|
|
createChannelMessageReplyPipeline.mockImplementationOnce(() => {
|
|
throw new Error("pipeline initialization failed");
|
|
});
|
|
|
|
await dispatchWithContext({
|
|
context: createContext({
|
|
ctxPayload: {
|
|
SessionKey: sessionKey,
|
|
ChatType: "direct",
|
|
} as TelegramMessageContext["ctxPayload"],
|
|
statusReactionController: statusReactionController as never,
|
|
reactionApi,
|
|
}),
|
|
runtime,
|
|
suppressFailureFallback: true,
|
|
});
|
|
|
|
await vi.waitFor(() => {
|
|
expect(statusReactionController.restoreInitial).toHaveBeenCalled();
|
|
});
|
|
expect(reactionApi).not.toHaveBeenCalled();
|
|
});
|
|
});
|