import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { mkdtempSync, rmSync } from 'fs'; import { tmpdir } from 'os'; import { join } from 'path'; import { createHandoff, listHandoffs, getHandoff } from '../src/core/services/handoffService.js'; describe('handoffService', () => { let cwd: string; beforeEach(() => { cwd = mkdtempSync(join(tmpdir(), 'ah-hof-')); }); afterEach(() => { rmSync(cwd, { recursive: true, force: true }); }); it('creates and reads a handoff', () => { const h = createHandoff(cwd, { fromRole: 'architect', toRole: 'implementer', summary: 's', context: 'c' }); expect(h.id).toBe('HOF-0001'); expect(getHandoff(cwd, h.id).handoff.summary).toBe('s'); expect(listHandoffs(cwd)).toHaveLength(1); }); });