Skip to content

feat: Add tests and implement real Zod validation utilities#215

Merged
Penielka merged 1 commit into
AetherEdu:mainfrom
AbayomiCoded:fix/test-coverage-to-meet-80-percent-threshold
Jul 1, 2026
Merged

feat: Add tests and implement real Zod validation utilities#215
Penielka merged 1 commit into
AetherEdu:mainfrom
AbayomiCoded:fix/test-coverage-to-meet-80-percent-threshold

Conversation

@AbayomiCoded

Copy link
Copy Markdown
Contributor

Description

Replaces stub validation utilities with proper Zod schema validation and adds comprehensive tests for services and controllers to meet the 80% coverage threshold across branches, functions, lines, and statements.

Fixes #21

Architecture Decision Records

  • This change does not require a new ADR (no architectural decision made)
  • This change requires a new ADR — I have created docs/adr/NNN-title.md following the ADR template
  • This change supersedes an existing ADR (docs/adr/NNN-title.md) — I have marked it as Superseded

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

Closes #21

Replaces stub validation functions with proper Zod schema validation
and adds comprehensive test coverage for services and controllers
to meet the 80% coverage threshold.

Validation Changes:
- Add Zod dependency and validation schemas for email, assignment,
  submission, and course data
- Implement validateSchema with proper error handling and formatting
- Add isEmail using Zod email validation
- Return structured validation results with detailed error messages

Test Coverage Additions:
- Add AnalyticsService tests covering cache logic, error handling,
  aggregation methods, and report generation
- Add UserController tests for all endpoint handlers including
  profile, settings, achievements, stats, role, and permissions
- Add validation utility tests for all validation functions

Files Added:
- tests/services/analyticsService.test.ts
- tests/controllers/userController.test.ts
- tests/utils/validation.test.ts

Files Modified:
- src/utils/validation.ts (implement real Zod validation)
@AbayomiCoded

Copy link
Copy Markdown
Contributor Author

@Penielka please, review.

@Penielka Penielka merged commit cc71bbd into AetherEdu:main Jul 1, 2026
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] Fix test coverage to meet 80% threshold

2 participants