Move tests to __tests__ folders, add unit tests for shared utils and services
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.
This commit is contained in:
30
packages/backend/__tests__/routes/v1/health.test.ts
Normal file
30
packages/backend/__tests__/routes/v1/health.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user