50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { createProgram, normalizeAliasFlags } from './index.js';
|
|
|
|
describe('CLI program', () => {
|
|
it('creates a commander program with expected commands', () => {
|
|
const program = createProgram();
|
|
const commandNames = program.commands.map((c) => c.name());
|
|
|
|
expect(commandNames).toContain('start');
|
|
expect(commandNames).toContain('tui');
|
|
expect(commandNames).toContain('send');
|
|
expect(commandNames).toContain('sessions');
|
|
expect(commandNames).toContain('doctor');
|
|
expect(commandNames).toContain('config');
|
|
expect(commandNames).toContain('skills');
|
|
expect(commandNames).toContain('backup');
|
|
expect(commandNames).toContain('setup');
|
|
expect(commandNames).toContain('onboard');
|
|
expect(commandNames).toContain('companion');
|
|
|
|
expect(commandNames).toContain('openai-auth');
|
|
expect(commandNames).toContain('openai-key');
|
|
expect(commandNames).toContain('anthropic-auth');
|
|
expect(commandNames).toContain('zai-auth');
|
|
expect(commandNames).toContain('gemini-auth');
|
|
});
|
|
|
|
it('registers doctor strict flag on doctor command', () => {
|
|
const program = createProgram();
|
|
const doctor = program.commands.find((c) => c.name() === 'doctor');
|
|
const strictOption = doctor?.options.find((o) => o.long === '--strict');
|
|
expect(strictOption).toBeDefined();
|
|
});
|
|
|
|
it('has version info', () => {
|
|
const program = createProgram();
|
|
expect(program.version()).toBeDefined();
|
|
});
|
|
|
|
it('has description', () => {
|
|
const program = createProgram();
|
|
expect(program.description()).toContain('AI');
|
|
});
|
|
|
|
it('normalizes --gemini-auth alias to gemini-auth command', () => {
|
|
const argv = normalizeAliasFlags(['node', 'flynn', '--gemini-auth']);
|
|
expect(argv).toEqual(['node', 'flynn', 'gemini-auth']);
|
|
});
|
|
});
|