The green pulse now visualises real task flow instead of looping randomly: - delegation (task → in_progress/reassigned) fires a green pulse architect→agent and the agent card turns 'active' (green ring + badge); - review submission (→ review) fires an amber pulse agent→architect and the card enters the 'reviewing' state. Pulses are one-shot, created per transition (SSE-driven, deduped against a baseline snapshot) and removed on arrival, which lights the destination node. At rest only the connectors breathe faintly. Active state recoloured green to match the pulse. Verified: delegation→down+active, review→up+reviewing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
import { mkdtempSync, rmSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { buildApp } from '../src/server/index.js';
|
|
import { init } from '../src/cli/commands/init.js';
|
|
|
|
describe('GET /team', () => {
|
|
let cwd: string;
|
|
let app: ReturnType<typeof buildApp>;
|
|
|
|
beforeEach(() => {
|
|
cwd = mkdtempSync(join(tmpdir(), 'ah-team-'));
|
|
init(cwd, { projectName: 'team-test', yes: true });
|
|
app = buildApp(cwd);
|
|
});
|
|
|
|
afterEach(() => {
|
|
rmSync(cwd, { recursive: true, force: true });
|
|
});
|
|
|
|
it('serves the team page as HTML', async () => {
|
|
const res = await app.inject({ method: 'GET', url: '/team' });
|
|
expect(res.statusCode).toBe(200);
|
|
expect(res.headers['content-type']).toContain('text/html');
|
|
|
|
const html = res.payload;
|
|
expect(html).toContain('<title>AgentHub Team</title>');
|
|
expect(html).toContain('team-test');
|
|
expect(html).toContain('/board');
|
|
expect(html).toContain('/team');
|
|
});
|
|
|
|
it('renders configured agents by role', async () => {
|
|
const res = await app.inject({ method: 'GET', url: '/team' });
|
|
const html = res.payload;
|
|
expect(html).toContain('architect');
|
|
expect(html).toContain('implementer');
|
|
expect(html).toContain('claude');
|
|
expect(html).toContain('codex');
|
|
});
|
|
|
|
it('marks an agent as busy when they have an in-progress task', async () => {
|
|
await app.inject({
|
|
method: 'POST',
|
|
url: '/tasks',
|
|
payload: { title: 'Busy work', role: 'implementer' },
|
|
});
|
|
await app.inject({
|
|
method: 'PATCH',
|
|
url: '/tasks/TSK-0001',
|
|
payload: { status: 'in_progress', assignedTo: 'codex' },
|
|
});
|
|
|
|
const res = await app.inject({ method: 'GET', url: '/team' });
|
|
const html = res.payload;
|
|
expect(html).toContain('TSK-0001');
|
|
// The busy agent's card is tagged for the live client sync and rendered active.
|
|
expect(html).toContain('data-agent="codex"');
|
|
expect(html).toContain('agent-card active');
|
|
expect(html).toContain('active');
|
|
});
|
|
});
|