feat: add minimal TUI with readline interface
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { formatPrompt, parseCommand, type TuiCommand } from './minimal.js';
|
||||
|
||||
describe('formatPrompt', () => {
|
||||
it('formats default prompt', () => {
|
||||
const prompt = formatPrompt('default');
|
||||
expect(prompt).toBe('flynn> ');
|
||||
});
|
||||
|
||||
it('formats thinking prompt', () => {
|
||||
const prompt = formatPrompt('thinking');
|
||||
expect(prompt).toContain('...');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseCommand', () => {
|
||||
it('parses /quit command', () => {
|
||||
const result = parseCommand('/quit');
|
||||
expect(result).toEqual({ type: 'quit' });
|
||||
});
|
||||
|
||||
it('parses /reset command', () => {
|
||||
const result = parseCommand('/reset');
|
||||
expect(result).toEqual({ type: 'reset' });
|
||||
});
|
||||
|
||||
it('parses /transfer command with target', () => {
|
||||
const result = parseCommand('/transfer telegram');
|
||||
expect(result).toEqual({ type: 'transfer', target: 'telegram' });
|
||||
});
|
||||
|
||||
it('parses /fullscreen command', () => {
|
||||
const result = parseCommand('/fullscreen');
|
||||
expect(result).toEqual({ type: 'fullscreen' });
|
||||
});
|
||||
|
||||
it('parses regular message', () => {
|
||||
const result = parseCommand('Hello, Flynn!');
|
||||
expect(result).toEqual({ type: 'message', content: 'Hello, Flynn!' });
|
||||
});
|
||||
|
||||
it('returns null for empty input', () => {
|
||||
const result = parseCommand('');
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user