Skip to content

backend: add strong typing and tests for /health endpoint#77

Open
nazneen-p1 wants to merge 1 commit into
Dev-Card:mainfrom
nazneen-p1:health-endpoint-fix
Open

backend: add strong typing and tests for /health endpoint#77
nazneen-p1 wants to merge 1 commit into
Dev-Card:mainfrom
nazneen-p1:health-endpoint-fix

Conversation

@nazneen-p1
Copy link
Copy Markdown

Summary

This PR adds explicit TypeScript typing for the /health endpoint and includes a Vitest test to ensure it consistently returns the expected response.

Closes #2


Type of Change

  • Bug fix
  • New feature
  • Refactor (no functional change)
  • UI / Design change
  • Tests only
  • Documentation
  • Infrastructure / DevOps
  • Security

What Changed

  • Added a TypeScript type (HealthResponse) for the /health endpoint in apps/backend/src/app.ts
  • Updated the /health route to return { status: 'ok' }
  • Added a test file (apps/backend/src/tests/app.test.ts) to verify the endpoint returns status 200 and correct response
  • Skipped Prisma and Redis plugins during test environment to avoid database dependency issues

How to Test

  1. Run pnpm install
  2. Run pnpm --filter @devcard/backend test
  3. Verify that all tests pass, including the /health endpoint test

Checklist

  • My code follows the project's coding style (pnpm -r run lint passes).
  • TypeScript compiles without errors (pnpm -r run typecheck).
  • I have added or updated tests for the changes I made.
  • All tests pass locally (pnpm -r run test).
  • I have updated documentation where necessary.
  • No new console.log or debug statements left in the code.
  • Breaking changes are documented in this PR description.

Additional Context

The /health endpoint is a simple status check, so no database connection is required. Prisma and Redis plugins are conditionally skipped in the test environment to ensure tests run reliably without requiring external services.

@nazneen-p1
Copy link
Copy Markdown
Author

Hi @ShantKhatri,

I have completed the implementation and all tests are passing locally.

The Vercel check appears to require authorization, so it might be failing due to permission.

Kindly review the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

backend: add strong typing and tests for /health endpoint

1 participant