Skip to content

[Feature]: Add test suite for backend #335

Description

@Mansi2007275

Problem statement

The backend/ (Node/Express API) currently has no test suite — no unit tests and no integration tests. This backend was recently migrated from Flask to Node/Express (#269), so the codebase is fresh and doesn't yet have test coverage. Without tests, regressions in API routes, database queries, or business logic can go unnoticed, especially as new contributors add features.

Proposed solution

Set up a test suite for the backend using a standard Node testing stack, for example:

  • Jest (or Mocha + Chai) as the test runner/assertion library
  • Supertest for HTTP/integration testing of Express routes
  • Mock or test-database setup for DB-dependent tests

Suggested initial scope:

  • Unit tests for utility/helper functions
  • Integration tests for core API endpoints (e.g. search, distro data routes)
  • Basic error-handling test cases (invalid input, DB failure, etc.)
  • CI integration so tests run automatically on PRs

Acceptance Criteria

  • Testing framework (Jest/Mocha) added to backend/package.json
  • At least one test file per major route/controller
  • npm test script added and documented in README
  • Tests pass in CI on every PR
  • Basic contributing note added on how to write/run backend tests

Alternatives considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions