Something went wrong. Try again.
Reference implementation for the Phoenix Architecture. Work in progress. aicoding.leaflet.pub
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107/** * Implementation — 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 architecturalLinter from '../architectural-linter.js';import * as boundaryPolicySchema from '../boundary-policy-schema.js';import * as implementationUnitStructure from '../implementation-unit-structure.js';import * as regenerationEngine from '../regeneration-engine.js';
describe('Implementation modules', () => { describe('Architectural Linter', () => { it('exports Phoenix traceability metadata', () => { expect(architecturalLinter._phoenix).toBeDefined(); expect(architecturalLinter._phoenix.name).toBe('Architectural Linter'); expect(architecturalLinter._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(architecturalLinter).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Boundary Policy Schema', () => { it('exports Phoenix traceability metadata', () => { expect(boundaryPolicySchema._phoenix).toBeDefined(); expect(boundaryPolicySchema._phoenix.name).toBe('Boundary Policy Schema'); expect(boundaryPolicySchema._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(boundaryPolicySchema).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Implementation Unit Structure', () => { it('exports Phoenix traceability metadata', () => { expect(implementationUnitStructure._phoenix).toBeDefined(); expect(implementationUnitStructure._phoenix.name).toBe('Implementation Unit Structure'); expect(implementationUnitStructure._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(implementationUnitStructure).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
describe('Regeneration Engine', () => { it('exports Phoenix traceability metadata', () => { expect(regenerationEngine._phoenix).toBeDefined(); expect(regenerationEngine._phoenix.name).toBe('Regeneration Engine'); expect(regenerationEngine._phoenix.risk_tier).toBeTruthy(); });
it('has exported functions', () => { const exports = Object.keys(regenerationEngine).filter(k => k !== '_phoenix'); expect(exports.length).toBeGreaterThan(0); }); });
});
describe('Implementation 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('Implementation'); });
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); });});