agenthub/tests/e2e.test.ts

24 lines
694 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 { execSync } from 'child_process';
describe('e2e', () => {
let cwd: string;
beforeEach(() => {
cwd = mkdtempSync(join(tmpdir(), 'agenthub-e2e-'));
});
afterEach(() => {
rmSync(cwd, { recursive: true, force: true });
});
it('initializes a project', () => {
const bin = join(process.cwd(), 'bin', 'agenthub.js');
execSync(`node ${bin} init --yes --project-name e2e-test`, { cwd });
expect(existsSync(join(cwd, '.agenthub', 'agenthub.config.json'))).toBe(true);
});
});