Delete endpoint + trash UI, shared header across all pages, task-log SSE + in-card console, reviewer separate from assignee (board+team), codex board redesign (3/4 kanban + company half-donuts + per-agent bars + square cards). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
import { mkdtempSync, rmSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { appendTaskLog, readTaskLog } from '../src/core/services/taskLogService.js';
|
|
|
|
describe('taskLogService', () => {
|
|
let cwd: string;
|
|
|
|
beforeEach(() => {
|
|
cwd = mkdtempSync(join(tmpdir(), 'ah-log-'));
|
|
});
|
|
afterEach(() => {
|
|
rmSync(cwd, { recursive: true, force: true });
|
|
});
|
|
|
|
it('returns an empty log for a task with no output yet', () => {
|
|
expect(readTaskLog(cwd, 'TSK-0001')).toEqual([]);
|
|
});
|
|
|
|
it('appends lines and reads them back in order', () => {
|
|
appendTaskLog(cwd, 'TSK-0001', { text: 'cloning repo', agent: 'backyard' });
|
|
appendTaskLog(cwd, 'TSK-0001', { text: 'running build', agent: 'backyard', level: 'info' });
|
|
const log = readTaskLog(cwd, 'TSK-0001');
|
|
expect(log).toHaveLength(2);
|
|
expect(log[0].text).toBe('cloning repo');
|
|
expect(log[0].agent).toBe('backyard');
|
|
expect(log[1].text).toBe('running build');
|
|
expect(log[0].ts).toBeTruthy();
|
|
});
|
|
|
|
it('keeps each task log isolated', () => {
|
|
appendTaskLog(cwd, 'TSK-0001', { text: 'a' });
|
|
appendTaskLog(cwd, 'TSK-0002', { text: 'b' });
|
|
expect(readTaskLog(cwd, 'TSK-0001')).toHaveLength(1);
|
|
expect(readTaskLog(cwd, 'TSK-0002')[0].text).toBe('b');
|
|
});
|
|
|
|
it('rejects empty log text', () => {
|
|
expect(() => appendTaskLog(cwd, 'TSK-0001', { text: ' ' })).toThrow();
|
|
});
|
|
});
|