1
0

chore: scaffold node/ts/vitest project with health endpoint

This commit is contained in:
2026-08-29 14:43:44 +02:00
parent 52b2cbd6c5
commit 01ad6fbb40
12 changed files with 3020 additions and 0 deletions

23
server/test/app.test.ts Normal file
View File

@@ -0,0 +1,23 @@
import { describe, it, expect } from 'vitest'
import { buildApp } from '../src/app.js'
import { openDatabase } from '../src/db.js'
import type { Config } from '../src/config.js'
const config: Config = {
dataDir: ':memory:',
artworkDir: ':memory:',
dbPath: ':memory:',
port: 0,
sessionSecret: 'test-secret-test-secret-test-secret-1234',
}
describe('GET /api/health', () => {
it('returns ok', async () => {
const db = openDatabase(':memory:')
const app = await buildApp({ db, config })
const res = await app.inject({ method: 'GET', url: '/api/health' })
expect(res.statusCode).toBe(200)
expect(res.json()).toEqual({ ok: true })
await app.close()
})
})