Skip to content

test: add unit tests for digest_service.py pure HTML helpers (#1478)#1747

Merged
ritesh-1918 merged 1 commit into
ritesh-1918:gssocfrom
duongynhi000005-oss:fix-issue-1478
Jun 5, 2026
Merged

test: add unit tests for digest_service.py pure HTML helpers (#1478)#1747
ritesh-1918 merged 1 commit into
ritesh-1918:gssocfrom
duongynhi000005-oss:fix-issue-1478

Conversation

@duongynhi000005-oss

Copy link
Copy Markdown

Summary

Fixes #1478

Adds backend/tests/test_digest_service_helpers.py with comprehensive unit tests for the two pure HTML rendering helpers in backend/services/digest_service.py:

_build_team_performance_html (10 tests)

  • Empty list returns 'no data' paragraph (no table)
  • Single team returns proper table with data row
  • High resolution rate (≥80%) uses green (#059669)
  • Medium resolution rate (50-79%) uses amber (#d97706)
  • Low resolution rate (<50%) uses red (#dc2626)
  • SLA breaches > 0 uses red (#dc2626)
  • Zero SLA breaches uses gray (#6b7280)
  • Multiple teams all appear in output
  • Proper table HTML structure with all column headers
  • Missing keys use sensible defaults (0%, N/A)

_build_category_list_html (5 tests)

  • Empty list returns 'no data' paragraph
  • Single category with name and count
  • Multiple categories all appear
  • Uses flexbox layout
  • Returns string type

All tests are pure (no mocking needed) since these are pure HTML builder functions.

Fixes ritesh-1918#1478

Add backend/tests/test_digest_service_helpers.py covering:
- _build_team_performance_html: empty list, single team, high/medium/low
  resolution rate colour-coding (green/amber/red), red vs gray breach
  colours, multiple teams, proper table HTML structure, missing keys
- _build_category_list_html: empty list, single category, multiple
  categories, flexbox layout, returns string type
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@duongynhi000005-oss is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b9696af5-c6c8-4aec-b9ac-ca68b6908e87

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ritesh-1918 ritesh-1918 added gssoc GirlScript Summer of Code gssoc:approved GSSoC Approved PR mentor:ritesh-1918 Reviewed by Project Admin Ritesh level:intermediate Intermediate level difficulty quality:clean Clean code quality type:testing Testing suites, mock coverages, CI/CD integrations labels Jun 5, 2026
@ritesh-1918

Copy link
Copy Markdown
Owner

Hi @duongynhi000005-oss! 🙌

Thank you so much for your excellent contribution: "test: add unit tests for digest_service.py pure HTML helpers (#1478)"! We really appreciate the high-quality code and effort you have put into the platform.

Just a quick, friendly heads-up as we prepare our manual merging and verification queues—please make sure to complete all the mandatory community steps listed below.

⚠️ Quick leaderboard tip: To secure the absolute highest GSSoC point tier for your contribution, please make sure you are following our project admin @ritesh-1918 manually on GitHub. Having all four onboarding steps cleared is highly preferable for manual PR approvals! ✨

Once those manual steps are verified, we'll get your PR officially merged into the gssoc branch (or keep it neatly cataloged if closed as integrated) and assign it the highest possible GSSoC S-Tier labels to maximize your leaderboard points!

Let's build something amazing together! 🚀🔥


🌟 Project Support & Developer Network (Show Some Love!)

As we prepare our manual verification and merging queues, please take a quick moment to ensure you have completed all four community steps:

  1. Star this repository: Helps our AI helpdesk get noticed! Star the repo here
  2. 🍴 Fork this repository: Keep a copy to build your own cool tools! Fork here
  3. 👤 Follow @ritesh-1918 on GitHub: Stay updated on real-time open-source projects! Follow ritesh-1918 here
  4. 💼 Connect on LinkedIn: Let's build a strong engineering connection! Connect with Ritesh on LinkedIn

Note: Having all four steps completed manually is required before your PR points are officially cleared.

@ritesh-1918 ritesh-1918 merged commit 07b32d9 into ritesh-1918:gssoc Jun 5, 2026
2 of 3 checks passed
@ritesh-1918

Copy link
Copy Markdown
Owner

Merged locally into gssoc branch. Thank you for your GSSoC contribution! 🚀🔥

@ritesh-1918 ritesh-1918 removed the mentor:ritesh-1918 Reviewed by Project Admin Ritesh label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC Approved PR gssoc GirlScript Summer of Code level:intermediate Intermediate level difficulty quality:clean Clean code quality type:testing Testing suites, mock coverages, CI/CD integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants