diff --git a/tests/e2e.test.ts b/tests/e2e.test.ts new file mode 100644 index 0000000..352043d --- /dev/null +++ b/tests/e2e.test.ts @@ -0,0 +1,23 @@ +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 and creates a task', () => { + 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); + }); +});