feat: add OpenAI OAuth, strict model overrides, and Gmail pull mode
This commit is contained in:
@@ -228,6 +228,35 @@ describe('TelegramAdapter', () => {
|
||||
expect(msg.metadata).toEqual({ isCommand: true, command: 'reset' });
|
||||
});
|
||||
|
||||
it('/model command strips @bot suffix in groups', async () => {
|
||||
const handler = vi.fn();
|
||||
adapter.onMessage(handler);
|
||||
|
||||
await adapter.connect();
|
||||
|
||||
// Find the /model command handler
|
||||
const modelCall = mockCommand.mock.calls.find((call) => call[0] === 'model');
|
||||
expect(modelCall).toBeDefined();
|
||||
const modelHandler = modelCall![1];
|
||||
|
||||
const ctx = {
|
||||
message: { message_id: 123, text: '/model@flynn_bot default github/gpt-5-mini' },
|
||||
chat: { id: 100 },
|
||||
from: { first_name: 'Will' },
|
||||
};
|
||||
|
||||
await modelHandler(ctx);
|
||||
|
||||
expect(handler).toHaveBeenCalledTimes(1);
|
||||
const msg: InboundMessage = handler.mock.calls[0][0];
|
||||
expect(msg.text).toBe('/model default github/gpt-5-mini');
|
||||
expect(msg.metadata).toEqual({
|
||||
isCommand: true,
|
||||
command: 'model',
|
||||
commandArgs: 'default github/gpt-5-mini',
|
||||
});
|
||||
});
|
||||
|
||||
// ── Auth middleware ───────────────────────────────────────────
|
||||
|
||||
it('auth middleware blocks unauthorized chat IDs', async () => {
|
||||
|
||||
Reference in New Issue
Block a user