Sifa professional network API (Fastify, AT Protocol, Jetstream) sifa.id/
at main 15 lines 468 B view raw
1import { describe, it, expect, afterAll } from 'vitest'; 2import { createDb } from '../../src/db/index.js'; 3 4describe('Database connection', () => { 5 const db = createDb(process.env.DATABASE_URL ?? 'postgresql://sifa:sifa@localhost:5432/sifa'); 6 7 afterAll(async () => { 8 await db.$client.end(); 9 }); 10 11 it('connects and runs a query', async () => { 12 const result = await db.execute('SELECT 1 as num'); 13 expect(result.rows[0]).toEqual({ num: 1 }); 14 }); 15});