mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-17 07:10:43 +00:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing";
|
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";
|
|
import { describe, it } from "vitest";
|
|
import { buildTelegramMessageContextForTest } from "./bot-message-context.test-harness.js";
|
|
|
|
describe("Telegram inbound context contract", () => {
|
|
it("keeps inbound context finalized", async () => {
|
|
const context = await buildTelegramMessageContextForTest({
|
|
cfg: {
|
|
agents: {
|
|
defaults: {
|
|
envelopeTimezone: "utc",
|
|
},
|
|
},
|
|
channels: {
|
|
telegram: {
|
|
groupPolicy: "open",
|
|
groups: { "*": { requireMention: false } },
|
|
},
|
|
},
|
|
} satisfies OpenClawConfig,
|
|
message: {
|
|
chat: { id: 42, type: "group", title: "Ops" },
|
|
text: "hello",
|
|
date: 1_736_380_800,
|
|
message_id: 2,
|
|
from: {
|
|
id: 99,
|
|
first_name: "Ada",
|
|
last_name: "Lovelace",
|
|
username: "ada",
|
|
},
|
|
},
|
|
});
|
|
|
|
const payload = context?.ctxPayload;
|
|
if (!payload) {
|
|
throw new Error("expected telegram inbound payload");
|
|
}
|
|
expectChannelInboundContextContract(payload);
|
|
});
|
|
});
|