import { describe, it, expect, beforeAll } from 'vitest'; import request from 'supertest'; import { createApp } from '../../server.js'; import { resetDb } from '../helpers/db.js'; import { migrateUp } from '../../lib/db/migrate.js'; let app; const owner = { Authorization: 'Bearer test-token' }; beforeAll(async () => { await resetDb(); await migrateUp(); process.env.OWNER_TOKEN = 'test-token'; app = createApp(); }); describe('voice transcribe route', () => { it('401 without a token', async () => { const res = await request(app).post('/api/voice/transcribe'); expect(res.status).toBe(401); }); it('400 when no audio supplied', async () => { const res = await request(app).post('/api/voice/transcribe').set(owner); expect(res.status).toBe(400); }); });