import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import { buildServer } from '../src/server.js'; import type { FastifyInstance } from 'fastify'; describe('Server', () => { let app: FastifyInstance; beforeAll(async () => { app = await buildServer({ NODE_ENV: 'test', PORT: 0, PUBLIC_URL: 'http://localhost:3100', DATABASE_URL: 'postgresql://test:test@localhost:5432/test', VALKEY_URL: 'redis://localhost:6379', SIFA_DID: 'did:plc:test', JETSTREAM_URL: 'wss://jetstream1.us-east.bsky.network/subscribe', OAUTH_JWKS_PATH: './keys/jwks.json', }); }); afterAll(async () => { await app.close(); }); it('GET /api/health returns 200', async () => { const res = await app.inject({ method: 'GET', url: '/api/health' }); expect(res.statusCode).toBe(200); expect(res.json()).toEqual({ status: 'ok' }); }); });