Files
overleaf-cep/services/notifications/test/acceptance/js/HealthCheck.test.ts
Andrew Rumble aef9639405 Add acceptance test to notifications
GitOrigin-RevId: de2d0ed8cab15c4347ddecf227073a6d4e06120f
2025-09-24 08:06:52 +00:00

32 lines
884 B
TypeScript

import { beforeAll, describe, it, expect } from 'vitest'
import { fetchStringWithResponse } from '@overleaf/fetch-utils'
import app from '../../../app.js'
import logger from '@overleaf/logger'
let runAppPromise: Promise<void> | null = null
async function ensureRunning(hostname: string, port: number) {
if (!runAppPromise) {
runAppPromise = new Promise(resolve => {
app.listen(port, hostname, () => {
logger.info({ port, hostname }, 'notifications running in dev mode')
resolve()
})
})
}
await runAppPromise
}
describe('HealthCheck endpoint', () => {
beforeAll(async () => {
await ensureRunning('127.0.0.1', 3042)
})
it('should return 200 for GET /health_check', async () => {
const { response } = await fetchStringWithResponse(
'http://localhost:3042/health_check'
)
expect(response.status).toBe(200)
})
})