import { describe, it, expect } from 'vitest';
import { getManifestCommands, mergeCommands, PROVIDER_COMMANDS } from '../provider-commands.js';

describe('provider-commands', () => {
  it('defines commands for every external harness', () => {
    for (const name of ['claude', 'opencode', 'goose', 'qwen']) {
      expect(getManifestCommands(name).length, name).toBeGreaterThan(0);
    }
  });

  it('boocode uses frontend skills — empty manifest', () => {
    expect(getManifestCommands('boocode')).toEqual([]);
    expect(PROVIDER_COMMANDS.boocode).toEqual([]);
  });

  it('mergeCommands dedupes by name with later override', () => {
    const merged = mergeCommands(
      [{ name: 'help', description: 'a' }],
      [{ name: 'help', description: 'b' }, { name: 'clear' }],
    );
    expect(merged).toEqual([
      { name: 'clear' },
      { name: 'help', description: 'b' },
    ]);
  });
});
