Files
waggle-os/packages/cli/tests/commands.test.ts
Oleg Maslov 0c3e2ead3b
Some checks failed
Installer Smoke / installer-smoke (push) Has been cancelled
moving
2026-09-02 10:10:29 +02:00

37 lines
1.1 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { parseCommand } from '../src/commands.js';
describe('parseCommand', () => {
it('parses /model command with args', () => {
const result = parseCommand('/model gpt-4o');
expect(result).toEqual({ name: 'model', args: 'gpt-4o' });
});
it('parses /exit (no args)', () => {
const result = parseCommand('/exit');
expect(result).toEqual({ name: 'exit', args: '' });
});
it('parses /help', () => {
const result = parseCommand('/help');
expect(result).toEqual({ name: 'help', args: '' });
});
it('returns null for regular messages', () => {
expect(parseCommand('hello world')).toBeNull();
expect(parseCommand('what is the weather?')).toBeNull();
expect(parseCommand('')).toBeNull();
expect(parseCommand(' some text ')).toBeNull();
});
it('parses /clear', () => {
const result = parseCommand('/clear');
expect(result).toEqual({ name: 'clear', args: '' });
});
it('parses /identity', () => {
const result = parseCommand('/identity');
expect(result).toEqual({ name: 'identity', args: '' });
});
});