Something went wrong. Try again.
Reference implementation for the Phoenix Architecture. Work in progress. aicoding.leaflet.pub
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107/** * Tasks — Generated Tests * * AUTO-GENERATED by Phoenix VCS * Tests module structure, server health, and Phoenix traceability. */
import { describe, it, expect, afterAll } from 'vitest';import { startServer } from '../server.js';
import * as assignment from '../assignment.js';import * as deadlineManagement from '../deadline-management.js';import * as searchAndFiltering from '../search-and-filtering.js';import * as taskLifecycle from '../task-lifecycle.js';
describe('Tasks modules', () => { describe('Assignment', () => { it('exports Phoenix traceability metadata', () => { expect(assignment._phoenix).toBeDefined(); expect(assignment._phoenix.name).toBe('Assignment'); expect(assignment._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(assignment).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Deadline Management', () => { it('exports Phoenix traceability metadata', () => { expect(deadlineManagement._phoenix).toBeDefined(); expect(deadlineManagement._phoenix.name).toBe('Deadline Management'); expect(deadlineManagement._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(deadlineManagement).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Search and Filtering', () => { it('exports Phoenix traceability metadata', () => { expect(searchAndFiltering._phoenix).toBeDefined(); expect(searchAndFiltering._phoenix.name).toBe('Search and Filtering'); expect(searchAndFiltering._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(searchAndFiltering).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Task Lifecycle', () => { it('exports Phoenix traceability metadata', () => { expect(taskLifecycle._phoenix).toBeDefined(); expect(taskLifecycle._phoenix.name).toBe('Task Lifecycle'); expect(taskLifecycle._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(taskLifecycle).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
});
describe('Tasks server', () => { const instance = startServer(0); // random port
afterAll(() => new Promise<void>(resolve => instance.server.close(() => resolve())));
it('GET /health returns 200', async () => { await instance.ready; const res = await fetch(`http://localhost:${instance.port}/health`); expect(res.status).toBe(200); const body = await res.json() as Record<string, unknown>; expect(body.status).toBe('ok'); expect(body.service).toBe('Tasks'); });
it('GET /metrics returns request counts', async () => { await instance.ready; const res = await fetch(`http://localhost:${instance.port}/metrics`); expect(res.status).toBe(200); const body = await res.json() as Record<string, unknown>; expect(typeof body.requests_total).toBe('number'); });
it('GET /modules lists all registered modules', async () => { await instance.ready; const res = await fetch(`http://localhost:${instance.port}/modules`); expect(res.status).toBe(200); const body = await res.json() as Array<Record<string, unknown>>; expect(body.length).toBe(4); });
it('GET /unknown returns 404', async () => { await instance.ready; const res = await fetch(`http://localhost:${instance.port}/unknown`); expect(res.status).toBe(404); });});