mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-25 17:02:46 +00:00
27 lines
758 B
TypeScript
27 lines
758 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { splitTelegramCaption, TELEGRAM_MAX_CAPTION_LENGTH } from "./caption.js";
|
|
|
|
describe("splitTelegramCaption", () => {
|
|
it("returns empty parts for blank captions", () => {
|
|
expect(splitTelegramCaption(" ")).toEqual({
|
|
caption: undefined,
|
|
followUpText: undefined,
|
|
});
|
|
});
|
|
|
|
it("keeps short captions inline", () => {
|
|
expect(splitTelegramCaption(" hello ")).toEqual({
|
|
caption: "hello",
|
|
followUpText: undefined,
|
|
});
|
|
});
|
|
|
|
it("moves oversized captions into follow-up text", () => {
|
|
const text = "x".repeat(TELEGRAM_MAX_CAPTION_LENGTH + 1);
|
|
expect(splitTelegramCaption(text)).toEqual({
|
|
caption: undefined,
|
|
followUpText: text,
|
|
});
|
|
});
|
|
});
|