opencode-config/.opencode/telegram/tests/e2e.manual.ts

18 lines
No EOL
960 B
TypeScript

// Manual E2E test — run with:
// node --experimental-strip-types tests/e2e.manual.ts
// Requires real TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID env vars.
import { sendMessage, sendDocument, sendPhoto } from "../src/api.ts"
import { loadConfig } from "../src/config.ts"
async function main() {
const { token, chatId } = loadConfig()
console.log("[e2e] sending text to", chatId)
const r1 = await sendMessage(token, chatId, "E2E test: *bold* _italic_ `code`", "MarkdownV2")
console.log("[e2e] text sent:", r1)
// document + photo — раскомментируй и подставь пути к реальным файлам:
// const r2 = await sendDocument(token, chatId, "/path/to/file.md", "caption")
// console.log("[e2e] document sent:", r2)
// const r3 = await sendPhoto(token, chatId, "/path/to/cover.png", "cover")
// console.log("[e2e] photo sent:", r3)
}
main().catch((e) => { console.error("[e2e] failed:", e); process.exit(1) })