// Local smoke test for Telegram client without real network // Mocks fetch to capture the request and return success import { sendTelegramMessage } from '../telegram.js' // Minimal env to pass config checks process.env.TELEGRAM_BOT_TOKEN = '123456:ABC-DEF_fake_token' process.env.TELEGRAM_CHAT_ID = '123456789' // can be negative for groups e.g. -1001234567890 // Mock global fetch globalThis.fetch = async (url, init) => { console.log('FETCH URL:', url) const body = JSON.parse(init.body) console.log('FETCH PAYLOAD:', body) return { ok: true, status: 200, async json() { return { ok: true, result: { message_id: 42 } } }, } } async function main() { const res = await sendTelegramMessage({ text: '🚲 Nouvelle demande de test\nAssociation: Demo\nPériode: 01/11/2025 10:00 → 12:00', parseMode: 'HTML', }) console.log('Telegram client returned:', res) } main().catch((e) => { console.error('Test failed:', e) process.exit(1) })