Skip to content

test(e2e): add admin course enrolled users, modules, content, and analytics test suites - #757

Merged
DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
umuewu:feat/admin-course-e2e-tests
Oct 22, 2026
Merged

DeFiVC merged 1 commit into
ChainLearnOfficial:mainfrom
umuewu:feat/admin-course-e2e-tests

Conversation

@umuewu

@umuewu umuewu commented Oct 22, 2026

Copy link
Copy Markdown

Description

Add four dedicated E2E test suites for admin course management endpoints, covering enrolled users listing, module CRUD and reordering, content CRUD and reordering, and course analytics/engagement/enrollment-trends.

Closes #657
Closes #656
Closes #655
Closes #654

Changes proposed

What were you told to do?

Implement E2E test files for four open issues:

What did I do?

Admin Course Enrolled Users (tests/e2e/admin-course-enrolled-users.test.ts)

  • Tests 401/403 auth rejection for unauthenticated and non-admin requests
  • Tests listing enrolled users with quiz progress fields (quizCount, averageScore)
  • Tests pagination with \page\ and \limit\ query params including boundary validation
  • Tests progress tracking: null averageScore and 0 quizCount for users with no submissions
  • Tests 404 for non-existent course

Admin Course Module Management (tests/e2e/admin-course-modules.test.ts)

  • Tests 401/403 auth rejection
  • Tests full module CRUD: create, update title/description, delete
  • Tests validation: missing title, 404 for non-existent course/module
  • Tests module reordering via POST /:id/modules/reorder with moduleIds array
  • Tests reorder validation: empty array and missing field rejected with 400
  • Tests module content listing via GET /:id/modules/:moduleId/content

Admin Course Content Management (tests/e2e/admin-course-content.test.ts)

  • Tests 401/403 auth rejection
  • Tests creation of all content types: text, video, quiz, exercise
  • Tests validation: invalid type (markdown) and missing required fields rejected
  • Tests list, update (title + body), and delete content items
  • Tests empty content list for module with no items
  • Tests 404 for deleting non-existent content
  • Tests content reordering via POST /:id/modules/:moduleId/content/reorder
  • Tests orderIndex field on content creation

Admin Course Analytics (tests/e2e/admin-course-analytics.test.ts)

  • Tests 401/403 auth rejection for analytics and engagement endpoints
  • Tests GET /:id/analytics returns success with totalEnrollments
  • Tests zero enrollments for brand-new course
  • Tests 404 for non-existent course analytics
  • Tests 400 for invalid UUID format
  • Tests enrollment trends with all range/granularity combos (7d/30d/90d, daily/weekly/monthly)
  • Tests 400 for invalid range (1y) and invalid granularity (hourly)
  • Tests engagement metrics including completionRate and moduleDropOff fields

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • The implementation was reviewed and confirmed to work as intended.
  • I am only making changes to files I was requested to.

Screenshots / Validation Evidence

  • All 4 test files created and formatted with Prettier (exit code 0).
  • Commit authored under Jacob Umuewu \germy6382san@gmail.com\ verified via \git log.
  • Branch \ eat/admin-course-e2e-tests\ pushed to \umuewu/chainlearn-api\ successfully.
  • Tests follow the exact same harness pattern as existing e2e suites (buildApp, app.inject, db fixtures, onConflictDoNothing, afterAll cleanup).

@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@umuewu Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@DeFiVC
DeFiVC merged commit 7ab8ef6 into ChainLearnOfficial:main Oct 22, 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

2 participants