···185185 expect(fetchMock).toHaveBeenCalledTimes(1);
186186 });
187187188188- test("sendMessage returns undefined when TELEGRAM_BOT_TOKEN is not set", async () => {
188188+ test("fetch not called when TELEGRAM_BOT_TOKEN is not set", async () => {
189189 process.env.TELEGRAM_BOT_TOKEN = undefined;
190190191191 const monitor = createMockMonitor();
+3-1
packages/notifications/telegram/src/index.ts
···131131 chatId: string;
132132 message: string;
133133}) {
134134- if (!process.env.TELEGRAM_BOT_TOKEN) return;
134134+ if (!process.env.TELEGRAM_BOT_TOKEN) {
135135+ throw new Error("TELEGRAM_BOT_TOKEN is not set");
136136+ }
135137 return fetch(
136138 `https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMessage?chat_id=${chatId}&text=${message}`,
137139 );