25 lines
768 B
TypeScript
25 lines
768 B
TypeScript
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
import { mkdtempSync, rmSync, existsSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { init } from '../src/cli/commands/init.js';
|
|
|
|
describe('cli init', () => {
|
|
let cwd: string;
|
|
|
|
beforeEach(() => {
|
|
cwd = mkdtempSync(join(tmpdir(), 'agenthub-'));
|
|
});
|
|
|
|
afterEach(() => {
|
|
rmSync(cwd, { recursive: true, force: true });
|
|
});
|
|
|
|
it('initializes project with --yes', async () => {
|
|
await init(cwd, { yes: true, projectName: 'test-proj' });
|
|
expect(existsSync(join(cwd, '.agenthub', 'agenthub.config.json'))).toBe(true);
|
|
expect(existsSync(join(cwd, 'AGENTS.md'))).toBe(true);
|
|
expect(existsSync(join(cwd, 'CLAUDE.md'))).toBe(true);
|
|
});
|
|
});
|