Skip to content

test: Implement comprehensive test coverage for all modules (past and future) #23

@coderabbitai

Description

@coderabbitai

Overview

This issue tracks the implementation of a comprehensive test suite for the entire syncup backend, covering all existing modules as well as any new modules added in future PRs.


Background

Raised during review of PR #22 (feat(tasks): Implement task CRUD API endpoints).
Original review comment: #22 (comment)

Requested by: @Zafar7645


Scope

Existing Modules to Cover

Module Controller Spec Service Spec Notes
auth auth.controller.spec.ts auth.service.spec.ts Already has basic spec; expand with full coverage
users users.controller.spec.ts users.service.spec.ts Already has basic spec; expand with full coverage
projects projects.controller.spec.ts projects.service.spec.ts Verify/expand coverage
board-columns board-columns.controller.spec.ts board-columns.service.spec.ts Needs mocked providers; currently uses concrete service
tasks tasks.controller.spec.ts tasks.service.spec.ts Needs mocked providers; currently uses concrete service

Testing Standards to Follow

  • Controller specs: Use useValue mocks for all service dependencies (avoid injecting concrete services with TypeORM repository dependencies). Stub all public service methods with jest.fn().
  • Service specs: Use getRepositoryToken() and useValue mocks for all TypeORM repository dependencies.
  • Coverage targets: Happy path + key error paths (e.g., NotFoundException, ForbiddenException, UnauthorizedException).
  • Guard testing: Mock JwtAuthGuard where needed in controller tests.

Future Modules

Any new module added to the project should include:

  • A controller spec with mocked service providers.
  • A service spec with mocked repository providers.
  • Tests for all public methods covering both success and error cases.

Acceptance Criteria

  • All controller specs use useValue mocks instead of concrete service classes.
  • All service specs use mocked TypeORM repositories via getRepositoryToken().
  • Each public method in every service has at least one success-path and one error-path test.
  • Each controller handler has at least one test verifying correct delegation to the service mock.
  • Tests pass in CI without requiring a live database connection.
  • This checklist is updated as new modules are introduced.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions