Restructure tests into __tests__/ directories at package root so they can be excluded from production builds. Add unit tests for dates, currency, lookup service, payment method default logic, and tax exemption state transitions.
31 lines
756 B
TypeScript
31 lines
756 B
TypeScript
import { describe, it, expect, beforeAll, afterAll } from 'bun:test'
|
|
import type { FastifyInstance } from 'fastify'
|
|
import { createTestApp } from '../../../src/test/helpers.js'
|
|
|
|
describe('GET /v1/health', () => {
|
|
let app: FastifyInstance
|
|
|
|
beforeAll(async () => {
|
|
app = await createTestApp()
|
|
})
|
|
|
|
afterAll(async () => {
|
|
await app.close()
|
|
})
|
|
|
|
it('returns ok when db and redis are connected', async () => {
|
|
const response = await app.inject({
|
|
method: 'GET',
|
|
url: '/v1/health',
|
|
})
|
|
|
|
expect(response.statusCode).toBe(200)
|
|
|
|
const body = response.json()
|
|
expect(body.status).toBe('ok')
|
|
expect(body.db).toBe('connected')
|
|
expect(body.redis).toBe('connected')
|
|
expect(body.timestamp).toBeDefined()
|
|
})
|
|
})
|