* fix(acp): normalize unicode flags and Telegram topic binding * feat(telegram/acp): restore topic-bound ACP and session bindings * fix(acpx): clarify permission-denied guidance * feat(telegram/acp): pin spawn bind notice in topics * docs(telegram): document ACP topic thread binding behavior * refactor(reply): share Telegram conversation-id resolver * fix(telegram/acp): preserve bound session routing semantics * fix(telegram): respect binding persistence and expiry reporting * refactor(telegram): simplify binding lifecycle persistence * fix(telegram): bind acp spawns in direct messages * fix: document telegram ACP topic binding changelog (#36683) (thanks @huntharo) --------- Co-authored-by: Onur <2453968+osolmaz@users.noreply.github.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveTelegramConversationId } from "./telegram-context.js";
|
|
|
|
describe("resolveTelegramConversationId", () => {
|
|
it("builds canonical topic ids from chat target and message thread id", () => {
|
|
const conversationId = resolveTelegramConversationId({
|
|
ctx: {
|
|
OriginatingTo: "-100200300",
|
|
MessageThreadId: "77",
|
|
},
|
|
command: {},
|
|
});
|
|
expect(conversationId).toBe("-100200300:topic:77");
|
|
});
|
|
|
|
it("returns the direct-message chat id when no topic id is present", () => {
|
|
const conversationId = resolveTelegramConversationId({
|
|
ctx: {
|
|
OriginatingTo: "123456",
|
|
},
|
|
command: {},
|
|
});
|
|
expect(conversationId).toBe("123456");
|
|
});
|
|
|
|
it("does not treat non-topic groups as globally bindable conversations", () => {
|
|
const conversationId = resolveTelegramConversationId({
|
|
ctx: {
|
|
OriginatingTo: "-100200300",
|
|
},
|
|
command: {},
|
|
});
|
|
expect(conversationId).toBeUndefined();
|
|
});
|
|
|
|
it("falls back to command target when originating target is missing", () => {
|
|
const conversationId = resolveTelegramConversationId({
|
|
ctx: {
|
|
To: "123456",
|
|
},
|
|
command: {
|
|
to: "78910",
|
|
},
|
|
});
|
|
expect(conversationId).toBe("78910");
|
|
});
|
|
});
|