#532 security Comment Section : Test Coverage Increase#682
Merged
RUKAYAT-CODER merged 1 commit intoMay 28, 2026
Merged
Conversation
…ode#532) Add comprehensive unit tests for 7 previously untested services (61 tests): - assessment/feedback/feedback-generation.service.spec.ts Tests all three feedback tiers (excellent/good/keep-practicing) and boundary values at exactly 50% and 80%. - assessment/scoring/score-calculation.service.spec.ts Tests MULTIPLE_CHOICE, TRUE_FALSE, CODING question types including correct/wrong/null responses and unknown question type fallback. - moderation/safety/content-safety.service.spec.ts Tests clean content (score=0), each flagged keyword (violence, hate, explicit, spam, scam), score capping at 1.0, case-insensitivity, and empty string input. - moderation/manual/manual-review.service.spec.ts Tests enqueue (create+save), getQueue (pending filter + ordering), and markReviewed (status update). - assessment/assessments.service.spec.ts Tests full CRUD (findAll, findOne, findByIds, create, update, remove), startAssessment, submitAssessment (not-found, timed-out, graded paths), and getResults. - courses/lessons/lessons.service.spec.ts Tests create (module not found), findOne, update, and remove — all including NotFoundException paths. - messaging/messaging.service.spec.ts Tests addMessageToQueue (with/without options, error propagation), processMessages (processor registration), and getQueueStatus. All 61 tests pass. No regressions introduced. Closes rinafcode#532
29 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add comprehensive unit tests for 7 previously untested services (61 tests):
assessment/feedback/feedback-generation.service.spec.ts Tests all three feedback tiers (excellent/good/keep-practicing) and boundary values at exactly 50% and 80%.
assessment/scoring/score-calculation.service.spec.ts Tests MULTIPLE_CHOICE, TRUE_FALSE, CODING question types including correct/wrong/null responses and unknown question type fallback.
moderation/safety/content-safety.service.spec.ts Tests clean content (score=0), each flagged keyword (violence, hate, explicit, spam, scam), score capping at 1.0, case-insensitivity, and empty string input.
moderation/manual/manual-review.service.spec.ts Tests enqueue (create+save), getQueue (pending filter + ordering), and markReviewed (status update).
assessment/assessments.service.spec.ts Tests full CRUD (findAll, findOne, findByIds, create, update, remove), startAssessment, submitAssessment (not-found, timed-out, graded paths), and getResults.
courses/lessons/lessons.service.spec.ts Tests create (module not found), findOne, update, and remove — all including NotFoundException paths.
messaging/messaging.service.spec.ts Tests addMessageToQueue (with/without options, error propagation), processMessages (processor registration), and getQueueStatus.
pr close #532
All 61 tests pass. No regressions introduced.
Linked Issue
Closes #N
What does this PR do?
Type of change
Pre-merge checklist (required)
Branch & metadata
feature/issue-<N>-<slug>/fix/issue-<N>-<slug>conventiondevelopormain)Code quality & tests
npm run lint:ci— zero ESLint warningsnpm run format:check— Prettier reports no changes needednpm run typecheck— zero TypeScript errorsnpm run test:ci— all tests pass, coverage ≥ 70%.spec.tsunit testsError handling & NestJS best practices
class-validator/class-transformerdecorators and are wired through NestJS pipes (e.g. globalValidationPipeor explicit)any/unknownreaching the domain)BadRequestException,UnauthorizedException,ForbiddenException,NotFoundException) instead of genericErrorLoggeror central logger service) with meaningful, structured messagesAuthGuard, role/permissions guards, custom guards) are applied to all new/modified endpoints where appropriateAPI documentation / Swagger
/api(or Swagger UI) reflects new/changed endpoints correctlyBreaking changes
Breaking change description (if applicable)
Test evidence (required)
Commands run locally
Manual / API verification
Screenshots / recordings (if applicable)