diff --git a/packages/bots/signal/src/index.ts b/packages/bots/signal/src/index.ts index a9bec189..8a28777f 100644 --- a/packages/bots/signal/src/index.ts +++ b/packages/bots/signal/src/index.ts @@ -24,7 +24,7 @@ export interface IncomingMessage { sourceName: string; text: string; timestamp: number; - groupId: string | null; + groupId: string | null | undefined; isGroup: boolean; attachments: Array<{ filename: string; url: string }>; } diff --git a/packages/bots/telegram/src/index.test.ts b/packages/bots/telegram/src/index.test.ts index 2ee0657c..90481170 100644 --- a/packages/bots/telegram/src/index.test.ts +++ b/packages/bots/telegram/src/index.test.ts @@ -4,6 +4,21 @@ import bot, { loadConfig, parseTelegramChatId, toBotEvent } from './index.js'; contractTestBot(bot, { sampleConfig: {}, sampleChannel: '1234567890' }); +describe('toBotEvent', () => { + it('falls back when Telegram provides an out-of-range timestamp', () => { + expect(toBotEvent({ + source: 'user-1', + sourceName: 'User', + text: 'hello', + timestamp: Number.NaN, + chatId: 123, + isGroup: false, + attachments: [], + raw: null as never, + }).timestamp).toBe('1970-01-01T00:00:00.000Z'); + }); +}); + describe('parseTelegramChatId', () => { it('accepts positive user and negative group chat ids', () => { expect(parseTelegramChatId('1234567890')).toBe(1234567890);