feat: make /transfer bidirectional across telegram and tui
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
import { createContextCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand } from './index.js';
|
||||
import { createContextCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand, createTransferCommand } from './index.js';
|
||||
|
||||
describe('builtin /model command', () => {
|
||||
it('passes through the full argument string', async () => {
|
||||
@@ -169,3 +169,31 @@ describe('builtin /context command', () => {
|
||||
expect(result).toEqual({ handled: true, text: 'Context command is not available in this session.' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('builtin /transfer command', () => {
|
||||
it('passes through the full target argument string', async () => {
|
||||
const cmd = createTransferCommand();
|
||||
const transferSession = vi.fn(() => 'Session transferred');
|
||||
const result = await cmd.execute(['telegram'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/transfer telegram',
|
||||
services: { transferSession },
|
||||
});
|
||||
expect(transferSession).toHaveBeenCalledWith('telegram');
|
||||
expect(result).toEqual({ handled: true, text: 'Session transferred' });
|
||||
});
|
||||
|
||||
it('returns not-available when service is missing', async () => {
|
||||
const cmd = createTransferCommand();
|
||||
const result = await cmd.execute(['tui'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/transfer tui',
|
||||
services: {},
|
||||
});
|
||||
expect(result).toEqual({ handled: true, text: 'Transfer command is not available in this session.' });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user