import { APP_KEY, APP_KEY_HEADER_NAME } from "#config/app.ts"
import { test } from "@japa/runner"
test.group("GET /health", () => {
test("should succeeds and get `isHealthy: true`", async ({
client,
assert,
}) => {
// Arrange - Given
// Act - When
const response = await client
.get("/health")
.header(APP_KEY_HEADER_NAME, APP_KEY)
const responseBody = response.body()
// Assert - Then
response.assertStatus(200)
assert.equal(responseBody.isHealthy, true)
})
test("should fails and unauthorized when the app key is not provided", async ({
const response = await client.get("/health")
response.assertStatus(401)