Sifa professional network API (Fastify, AT Protocol, Jetstream)
sifa.id/
1import { describe, it, expect, beforeAll, afterAll } from 'vitest';
2import { buildServer } from '../src/server.js';
3import type { FastifyInstance } from 'fastify';
4
5describe('Server', () => {
6 let app: FastifyInstance;
7
8 beforeAll(async () => {
9 app = await buildServer({
10 NODE_ENV: 'test',
11 PORT: 0,
12 PUBLIC_URL: 'http://localhost:3100',
13 DATABASE_URL: 'postgresql://test:test@localhost:5432/test',
14 VALKEY_URL: 'redis://localhost:6379',
15 SIFA_DID: 'did:plc:test',
16 JETSTREAM_URL: 'wss://jetstream1.us-east.bsky.network/subscribe',
17 OAUTH_JWKS_PATH: './keys/jwks.json',
18 });
19 });
20
21 afterAll(async () => {
22 await app.close();
23 });
24
25 it('GET /api/health returns 200', async () => {
26 const res = await app.inject({ method: 'GET', url: '/api/health' });
27 expect(res.statusCode).toBe(200);
28 expect(res.json()).toEqual({ status: 'ok' });
29 });
30});