import { expect, test, mock } from 'bun:test';
import { importCommands } from './import-commands';
import path from 'node:path';

test('importCommands imports commands from files matching pattern', async () => {
  const commands = await importCommands('**/*.command.{js,ts}', path.join(__dirname, '../../fixtures'));

  expect(commands).toHaveProperty('test1');
  expect(commands).toHaveProperty('test2');
  expect(commands.test1.definition.name).toBe('test1');
  expect(commands.test2.definition.name).toBe('test2');
});

test('importCommands uses default pattern and baseDir', async () => {
  const commands = await importCommands();

  // Since there are no command files in src, it should be empty
  expect(commands).toEqual({});
});
