Skip to content

test: add query parameter boundary validation tests for streak API#3663

Open
sureshsuriya wants to merge 2 commits into
JhaSourav07:mainfrom
sureshsuriya:test/query-param-validation
Open

test: add query parameter boundary validation tests for streak API#3663
sureshsuriya wants to merge 2 commits into
JhaSourav07:mainfrom
sureshsuriya:test/query-param-validation

Conversation

@sureshsuriya
Copy link
Copy Markdown
Contributor

@sureshsuriya sureshsuriya commented Jun 4, 2026

Summary

This PR adds comprehensive unit tests for query parameter boundary validation in the streak API route.

Changes Made

Grace Parameter Validation

  • Added tests for minimum boundary (grace=0)
  • Added tests for maximum boundary (grace=7)
  • Added tests for values exceeding the maximum boundary
  • Added tests for negative values
  • Added tests for non-numeric values
  • Added tests for decimal values
  • Added tests for malformed inputs and special characters

Opacity Parameter Validation

  • Added tests for minimum boundary (opacity=0.1)
  • Added tests for maximum boundary (opacity=1.0)
  • Added tests to verify clamping below the minimum boundary
  • Added tests to verify clamping above the maximum boundary
  • Added tests for invalid and malformed values
  • Added tests for edge cases and valid range handling

Combined Parameter Validation

  • Added tests for both parameters at minimum boundaries
  • Added tests for both parameters at maximum boundaries
  • Added tests for mixed valid and invalid parameter combinations

Results

  • Added 34+ comprehensive unit tests
  • All 174 tests pass successfully
  • Ensures strict boundary enforcement for query parameters
  • Prevents future regressions during refactoring
  • Verifies runtime clamping and validation behavior

Closes #3659

Description

This PR introduces a dedicated test suite to validate boundary handling and clamping behavior for the grace and opacity query parameters in the streak API.

Pillar

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

Visual Preview

N/A (Test-only change)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • 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.
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started 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).

…k API

- Add 30+ comprehensive boundary validation tests for grace parameter (0-7 range)
- Add 14+ boundary validation tests for opacity parameter (0.1-1.0 range)
- Add combined parameter validation tests
- Tests verify strict boundary enforcement and proper validation error messages
- All 174 tests pass, providing complete coverage of parameter clamping behavior
- Ensures future code refactors don't accidentally remove validation logic

Closes JhaSourav07#3659
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 4, 2026

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

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Collaborator

@Aamod007 Aamod007 left a comment

Choose a reason for hiding this comment

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

LGTM! Comprehensive API boundary tests.

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks gssoc26 mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests GSSoC 2026 and removed gssoc26 labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSSoC 2026 level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: add unit tests for query parameter boundary validation in streak API

2 participants