1
0
Files
record-shop/server/test/app.test.ts

24 lines
690 B
TypeScript
Raw Normal View History

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()
})
})