Something went wrong. Try again.
Reference implementation for the Phoenix Architecture. Work in progress. aicoding.leaflet.pub
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879/** * Groups — 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 groupManagement from '../group-management.js';import * as groupSummary from '../group-summary.js';
describe('Groups modules', () => { describe('Group Management', () => { it('exports Phoenix traceability metadata', () => { expect(groupManagement._phoenix).toBeDefined(); expect(groupManagement._phoenix.name).toBe('Group Management'); expect(groupManagement._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(groupManagement).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Group Summary', () => { it('exports Phoenix traceability metadata', () => { expect(groupSummary._phoenix).toBeDefined(); expect(groupSummary._phoenix.name).toBe('Group Summary'); expect(groupSummary._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(groupSummary).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
});
describe('Groups 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('Groups'); });
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(2); });
it('GET /unknown returns 404', async () => { await instance.ready; const res = await fetch(`http://localhost:${instance.port}/unknown`); expect(res.status).toBe(404); });});