Skip to content

test(api-compare): verify dark and light prefers-color-scheme visual cohesion #4431#5746

Merged
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
Rakshak05:issue-#4431-v2
Jun 15, 2026
Merged

test(api-compare): verify dark and light prefers-color-scheme visual cohesion #4431#5746
JhaSourav07 merged 4 commits into
JhaSourav07:mainfrom
Rakshak05:issue-#4431-v2

Conversation

@Rakshak05

Copy link
Copy Markdown
Contributor

Closes #4431

Description

This PR introduces isolated unit and integration testing targeting Dark and Light Prefers-Color-Scheme Visual Cohesion for the comparison API route (app/api/compare/route.ts).

Specifically, it creates the new test file app/api/compare/route.theme-contrast.test.ts implementing the following 5 test cases:

  1. Dual-theme environment mock: Mocks window.matchMedia for both dark and light settings to verify that the JSON response payload carries no hardcoded color tokens (hex values, rgb/rgba, or Tailwind color classes).
  2. Color contrast validation: Asserts that all simulated API error responses (404, 403, 500, 502) contain only plain text and do not smuggle presentation-level styles (such as ANSI escape codes, style/class attributes, or zero-width characters) that would break client-side contrast enforcement.
  3. Tailwind/stylesheet class checks: Checks that the response headers carry no custom presentational headers (e.g., X-Theme or X-Color-Scheme) and that Content-Type is strictly application/json, leaving theme styling controls fully to the client.
  4. Background overlay check: Verifies that successful API payloads return fully populated user objects to prevent consuming UI cards from rendering as empty, background-colored overlay containers.
  5. Visual cohesion headers check: Passes dark and light Sec-CH-Prefers-Color-Scheme client headers to verify that the API returns structurally identical payloads in both modes.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs, testing)

Visual Preview

N/A (Backend / API Tests)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have starred the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

Copilot AI review requested due to automatic review settings June 15, 2026 08:07
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@Rakshak05 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3433.75 KB 3433.75 KB 0 B
Total CSS 258.05 KB 258.05 KB 0 B

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. mentor:Aamod007 type:testing Adding, updating, or fixing tests type:design UI designs, styling, SVG icons, and themes labels Jun 15, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the PR title/description, linked issue #4431, checks, and the diff before labeling.

Labels applied:

  • level:intermediate: the new app/api/compare/route.theme-contrast.test.ts file is a fairly large 208-line route test suite covering multiple success and error branches.
  • quality:clean: the test cases are organized by concern and the getFullDashboardData mock keeps the route behavior isolated.
  • type:testing: the PR is dedicated test coverage for the compare route.
  • type:design: the assertions are explicitly about theme contrast, style tokens, and client-hint-driven visual cohesion.

I’m leaving this as a neutral comment rather than approving because the repo checks are green but the PR still carries a failing Vercel status context. That looks like a deployment integration/auth issue rather than a code failure.

To unblock it, the Vercel GitHub integration for the repo/team needs to be re-authorized or the status needs to be marked non-blocking by maintainers. Once the Vercel context is green, this can be reviewed normally.

@Aamod007 Aamod007 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 15, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file is doing useful work for �pp/api/compare/route.theme-contrast.test.ts. The mocked theme paths, error-status coverage, and payload equality checks give the route a clear guardrail against theme-sensitive regressions.

@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 15, 2026
@JhaSourav07 JhaSourav07 merged commit 6172034 into JhaSourav07:main Jun 15, 2026
11 of 12 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @Rakshak05! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:design UI designs, styling, SVG icons, and themes type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(ApiCompareRoute-theme-contrast): verify Dark and Light Prefers-Color-Scheme Visual Cohesion (Variation 3)

4 participants