Skip to content

[test] add automated test suite for API #72

Description

@GabrielNat1

Add Automated Test Suite for the API

Description

The repository currently does not have an automated test suite for the API. No src/test directory or test files were found during the inspection.

Tests are needed to prevent regressions and verify critical functionality such as authentication, JWT security, services, and security filters.

Evidence

The following areas currently have no detectable test coverage:

  • controller
  • dto
  • exceptions
  • model
  • repository
  • security
  • serializer
  • service
  • vpn

Impact

  • Changes may introduce regressions without being detected.
  • Authentication and security issues may reach production.
  • CI/CD releases become less reliable without automated validation.

Recommendations

Create unit and integration tests using JUnit 5, Mockito, and Spring Boot Test.

Prioritize critical components such as:

  • AuthController
  • JwtUtil
  • UserService
  • VpnCheckerService
  • AntiVpnFilter
  • RateLimitingFilter

Add GitHub Actions to run mvn test automatically on pull requests and pushes to main.

Test Coverage Checklist

Config

  • Tests created

Controller

  • Tests created
  • AuthController tested

DTO

  • Tests created where applicable

Exceptions

  • Tests created where applicable

Model

  • Tests created where applicable

Repository

  • Tests created
  • Custom queries tested where applicable

Security

  • Tests created
  • JwtUtil tested
  • RateLimitingFilter tested

Serializer

  • Tests created where applicable

Service

  • Tests created
  • UserService tested

VPN

  • Tests created
  • VpnCheckerService tested
  • AntiVpnFilter tested

Integration

  • Authentication endpoints tested
  • JWT authentication flow tested
  • Protected endpoints tested

Acceptance Criteria

  • Test structure created under src/test/java
  • Critical components have automated tests
  • Authentication and JWT security are covered
  • Integration tests cover the main API flows
  • mvn test runs successfully
  • Tests are executed automatically through GitHub Actions

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions