Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bots/signal/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }>;
}
Expand Down
15 changes: 15 additions & 0 deletions packages/bots/telegram/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading