Repository navigation
Description
π§ Project Area
Testing / Quality
π Issue Summary and Problem Description
Issue summary:
The six backend service modules β auth, documents, verifications, vault, notifications, search β have zero unit test coverage. The entire test suite consists of only 19 tests across 3 files (1 integration, 2 unit), and none test any service-layer business logic.
Current test inventory:
| File | Tests | What it covers |
|---|---|---|
backend/tests/integration/app.test.js |
~11 | HTTP integration for documents/dashboard |
backend/tests/unit/env.test.js |
~7 | Environment config defaults |
backend/tests/unit/gracefulShutdown.test.js |
~1 | Shutdown signal handling |
Problem description:
The service layer contains the core business logic: password hashing, token generation, document verification (SHA-256 hash comparison), vault sharing/invitation flows, email notifications, and full-text search. Without tests:
- Regressions in critical security logic (auth, verification) go undetected
- Refactoring carries high risk
- New contributors lack test examples to follow
- CI provides a false sense of coverage
Who is affected:
All developers and users. Lack of test coverage directly impacts software reliability and developer confidence.
π Current and Expected Behaviour
Current behaviour:
auth.service.tsβ 0 tests (register, login, refresh, forgotPassword, resetPassword, verifyEmail, resendVerification)document.service.tsβ 0 tests (CRUD, upload, verify, search, filter, archive, favorite, summary)verification.service.tsβ 0 tests (verifyDocument, revokeVerification, getVerificationByHash)vault.service.tsβ 0 tests (invite, accept, decline, leave, getVaultMembers)notification.service.tsβ 0 tests (createNotification, getNotifications, markAsRead)search.service.tsβ 0 tests (fullTextSearch, filterDocuments)
Expected behaviour:
Each service has unit tests covering happy path, error paths, and edge cases.
π§© Reproduction and Evidence
Step 1: Run `cd backend && npm test`
Step 2: Observe 19 passing tests
Step 3: Check coverage β no service files are testedEvidence:
backend/tests/directory contains only 3 test filesbackend/src/modules/auth/auth.service.tsβ 15+ exported functions, 0 testsbackend/src/modules/documents/document.service.tsβ 15+ exported functions, 0 tests
π― Affected Scope
Affected files (new test files to create):
backend/tests/unit/auth.service.test.tsbackend/tests/unit/document.service.test.tsbackend/tests/unit/verification.service.test.tsbackend/tests/unit/vault.service.test.tsbackend/tests/unit/notification.service.test.tsbackend/tests/unit/search.service.test.ts
Affected APIs: All API endpoints (service tests validate the underlying business logic)
Database changes required? Yes β tests should use mongodb-memory-server
π₯ Environment
Operating system: All
Node.js version: v22.x
Package manager: npm 10.x
Deployment environment: Local development and CI
π‘ Solution, Alternatives, and Estimate
Priority: P1 High
Proposed solution:
- Install
mongodb-memory-server(if not already a dev dependency) - Create per-service test files under
backend/tests/unit/ - For database-dependent tests (document, verification), use
mongodb-memory-server - For auth service tests, mock the database or use in-memory MongoDB
- Each test file covers: happy path, error paths, edge cases
Alternative solutions:
Could be split into 6 separate issues (one per service) to allow parallel contributions.
Difficulty: Advanced
Estimated time: 20-30 hours (across all 6 services)
Dependencies or blockers: mongodb-memory-server package
β Acceptance Criteria and Additional Notes
-
auth.service.tshas tests for register, login, refreshToken, forgotPassword, resetPassword -
document.service.tshas tests for create, findById, update, delete, search, filter, getSummary -
verification.service.tshas tests for verifyDocument, revokeVerification, getVerificationByHash -
vault.service.tshas tests for invite, accept, decline, leave -
notification.service.tsandsearch.service.tshave basic happy-path tests - All 19 existing tests continue to pass
- Test files use
node:testandnode:assert(consistent with existing tests)
Additional notes:
This is a large task that could be split into multiple issues (one per service) to allow parallel contributions by different developers.
π€ Contributor Checklist
- I have searched existing issues and pull requests for duplicates.
- I can reproduce the issue, or I have clearly explained why reproduction is not applicable.
- I will follow the contribution guidelines and target
ecsoc-2026. - I agree to follow the Code of Conduct.
- I have removed secrets, private documents, and personal data.
Activity
Atharv094 commentedon Aug 1, 2026
Hi team, I'd love to add unit tests for all six service modules using
mongodb-memory-serverandnode:test/node:assert, covering key logic likeauthandverificationSHA-256 checks. Please assign this issue to me! Also, is this under the ECSoC program? If so, could you please add the "EcSoc26" label? Thanks!Dhruvi2006-source commentedon Aug 30, 2026
/claim
Atharv094 commentedon Aug 30, 2026
Hi! Iβd like to help add unit tests for
auth.service.tsusingnode:testandmongodb-memory-server. Could you please assign this issue to me? Also, is this an ECSoC project? If so, an admin could add the "EcSoc26" label. Thank you!