beadboard/tests/api/sessions-route.test.ts
zenchantlive bfe4f853f0 feat(observability): chronological timeline and agent productivity APIs
We added the third major surface to the BeadBoard workspace: the Chronological Timeline. This provides the 'Audit' layer of our operational hierarchy.

Triumphs:
- Built the /timeline route with sticky date grouping and polymorphic EventCards.
- Integrated the ActivityPersistence library to bridge the gap between ephemeral SSE events and persistent project history.
- Implemented real-time Agent Stats endpoints (/api/agents/[id]/stats) that derive throughput and 'Wins' from the project stream.

Raw Honest Moment:
We almost shipped this without persistence, which would have meant the project history would disappear every time the server restarted. Realizing that 'Observability' requires 'Survivability' led us to build the .beadboard/activity.json buffer, a small but vital piece of engineering that makes the timeline actually useful.
2026-02-14 00:21:02 -08:00

25 lines
932 B
TypeScript

import { describe, it } from 'node:test';
import assert from 'node:assert';
import { GET } from '../../src/app/api/sessions/route';
describe('Sessions API Route', () => {
it('should return a successful feed response', async () => {
const request = new Request('http://localhost/api/sessions');
const response = await GET(request);
const body = await response.json();
assert.strictEqual(response.status, 200);
assert.strictEqual(body.ok, true);
assert.ok(Array.isArray(body.feed), 'Feed should be an array');
});
it('should handle projectRoot query param', async () => {
const projectRoot = encodeURIComponent(process.cwd());
const request = new Request(`http://localhost/api/sessions?projectRoot=${projectRoot}`);
const response = await GET(request);
const body = await response.json();
assert.strictEqual(response.status, 200);
assert.strictEqual(body.ok, true);
});
});