freshyo/apps/backend/tests/api/health.test.ts
2026-09-26 17:50:33 +05:30

32 lines
959 B
TypeScript

/**
* Connectivity + config. No auth required.
*/
import { apiClient, assertServerUp, health } from '../helpers/api'
describe('health & config', () => {
beforeAll(async () => {
await assertServerUp()
})
it('GET /api/health responds 200', async () => {
const res = await health()
expect(res.status).toBe(200)
expect(res.ok).toBe(true)
})
it('common.healthCheck resolves over tRPC', async () => {
const result = await apiClient().common.healthCheck.query()
expect(result).toBeTruthy()
})
it('common.essentialConsts returns the runtime config', async () => {
const consts = await apiClient().common.essentialConsts.query()
expect(typeof consts.freeDeliveryThreshold).toBe('number')
expect(typeof consts.assetsDomain).toBe('string')
expect(typeof consts.apiCacheKey).toBe('string')
expect(typeof consts.cacheVersion).toBe('number')
expect(typeof consts.slotsVersionNum).toBe('number')
})
})