You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sims-hq/apps/hq/test/health.test.ts

16 lines
584 B
TypeScript

import { describe, it, expect, beforeAll, afterAll } from 'vitest'
import { startServer } from '../src/server'
let server: Awaited<ReturnType<typeof startServer>>
const base = () => `http://localhost:${(server.address() as { port: number }).port}`
describe('hq health', () => {
beforeAll(async () => { server = await startServer(0) })
afterAll(() => server.close())
it('answers /api/health', async () => {
const res = await fetch(`${base()}/api/health`)
expect(res.status).toBe(200)
expect(await res.json()).toMatchObject({ ok: true, service: 'sims-hq' })
})
})