Skip to content

feat: tests and fixes for personalised frontend pages (Quiz, Assignment, Certificate)#413

Merged
payamnj merged 1 commit intomasterfrom
copilot/create-personalised-pages
May 5, 2026
Merged

feat: tests and fixes for personalised frontend pages (Quiz, Assignment, Certificate)#413
payamnj merged 1 commit intomasterfrom
copilot/create-personalised-pages

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

The personalised user-facing pages existed as React entry points but had no tests, a missing locale key causing a blank heading, and a stale filename reference in the Vite config.

Fixes

  • vite.config.js: Corrected optimizeDeps.entries entry QuizPublic.jsxQuiz.jsx (file never existed under that name)
  • CertificateFormView: Added missing form_title locale key — the certificate form was rendering an empty <h4> because the key was never passed from the Django view

Testability

Each personalised component was an entry point with no export, making unit testing impossible. Added named exports alongside the existing render() call:

// before
render({ children: <Quiz /> });

// after
export { Quiz };
render({ children: <Quiz /> });

New tests (40 total across 4 files)

File Tests
Quiz.test.jsx Question/answer rendering, checkbox selection, submit dialog, score display, error state, negative-marking warning
Assignment.test.jsx Text/file submission fields, validation gating, API payload shape, success/error states
Certificate.test.jsx Certificate content, QR code, optional logo, error fallback
CertificateForm.test.jsx Validation, form submission, success alert, View Certificate link, API error

- Add named exports to Quiz, Assignment, Certificate, CertificateForm for testability
- Add test files: Quiz.test.jsx, Assignment.test.jsx, Certificate.test.jsx, CertificateForm.test.jsx
- Fix missing form_title locale key in CertificateFormView (Django)
- Fix wrong vite.config.js optimizeDeps entry (QuizPublic.jsx → Quiz.jsx)

Agent-Logs-Url: https://github.com/AvaCodeSolutions/django-email-learning/sessions/c5f36ad7-1f40-4556-8fc2-0823ad456874

Co-authored-by: payamnj <[email protected]>
@payamnj payamnj marked this pull request as ready for review May 5, 2026 13:31
@payamnj payamnj merged commit 57e9e9e into master May 5, 2026
8 checks passed
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.

2 participants