feat: v0.5.0 — machine-readable API docs: GET /api/version + OpenAPI 3.1 spec at /api/openapi; AGENTS.md points agents at the live spec
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import pkg from '@/package.json';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { GET } from './route';
|
||||
|
||||
describe('GET /api/version', () => {
|
||||
it('returns 200 with the version sourced from package.json', async () => {
|
||||
const res = await GET();
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.headers.get('content-type')).toContain('application/json');
|
||||
const body = (await res.json()) as { version: string };
|
||||
expect(body.version).toBe(pkg.version);
|
||||
});
|
||||
|
||||
it('returns exactly the version field', async () => {
|
||||
const res = await GET();
|
||||
expect(await res.json()).toEqual({ version: pkg.version });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
import pkg from '@/package.json';
|
||||
|
||||
export async function GET() {
|
||||
return Response.json({ version: pkg.version });
|
||||
}
|
||||
Reference in New Issue
Block a user