27a0600dcd
* chore(healthchecks): refactor out of modules * feat(server): multi-region aware liveness and readiness checks * Add tests for redis & postgres healthchecks * do not close Redis client after checking it is healthy, we now use a shared client
24 lines
701 B
TypeScript
24 lines
701 B
TypeScript
/* istanbul ignore file */
|
|
import { ReadinessHandler } from '@/healthchecks/types'
|
|
import { beforeEachContext } from '@/test/hooks'
|
|
import { expect } from 'chai'
|
|
import request from 'supertest'
|
|
|
|
describe('Health Routes @api-rest', () => {
|
|
let app: Express.Application
|
|
let readinessCheck: ReadinessHandler
|
|
before(async () => {
|
|
;({ app, readinessCheck } = await beforeEachContext())
|
|
})
|
|
|
|
it('Should response to liveness endpoint', async () => {
|
|
const res = await request(app).get('/liveness')
|
|
expect(res).to.have.status(200)
|
|
})
|
|
|
|
it('Should response to readiness endpoint', async () => {
|
|
const res = await readinessCheck()
|
|
expect(res).to.have.property('details')
|
|
})
|
|
})
|