Skip to content

test(index-accessibility): verify Types Integrity & Restrictions#5310

Merged
JhaSourav07 merged 2 commits into
JhaSourav07:mainfrom
realtushartyagi:test/index-accessibility
Jun 12, 2026
Merged

test(index-accessibility): verify Types Integrity & Restrictions#5310
JhaSourav07 merged 2 commits into
JhaSourav07:mainfrom
realtushartyagi:test/index-accessibility

Conversation

@realtushartyagi

Copy link
Copy Markdown
Contributor

Description

Fixes #4651

Adds type validation tests for types/index.ts using expectTypeOf.

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 (Integration Test update)

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 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).
  • (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 11, 2026 20:20

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds compile-time type integrity tests (via Vitest expectTypeOf) to validate exported type unions and branded types.

Changes:

  • Introduces a new Vitest type-test suite covering Scale, NotificationFrequency, BadgeSize, BadgeParams, and HexColor.
  • Adds negative assertions to prevent invalid literal/type assignments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { describe, it, expectTypeOf } from 'vitest';
import type { BadgeSize, Scale, NotificationFrequency, BadgeParams, HexColor } from './index';

describe('Types Integrity & Validation Tests', () => {
import type { BadgeSize, Scale, NotificationFrequency, BadgeParams, HexColor } from './index';

describe('Types Integrity & Validation Tests', () => {
it('1. correctly restricts Scale to specific valid literals', () => {
expectTypeOf<'invalid'>().not.toMatchTypeOf<Scale>();
});

it('2. properly enforces NotificationFrequency literal unions', () => {
expectTypeOf<'monthly'>().not.toMatchTypeOf<NotificationFrequency>();
});

it('3. validates BadgeSize string unions', () => {
expectTypeOf<'xl'>().not.toMatchTypeOf<BadgeSize>();
});

it('4. ensures BadgeParams defines strict types for core properties', () => {
expectTypeOf<BadgeParams['bg']>().toEqualTypeOf<HexColor>();
});

it('5. confirms HexColor utilizes branding to prevent arbitrary string assignment', () => {
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Hey @realtushartyagi, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 11, 2026
@Aamod-Dev Aamod-Dev added quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. level:beginner Small changes Usually isolated fixes or simple UI/text updates. labels Jun 12, 2026

@Aamod-Dev Aamod-Dev 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.

Good work on this one. I reviewed the diff and it looks ready to go from my side.

The test coverage added here looks comprehensive and well-structured. It definitely improves the reliability of the system.

No concerns from my end. Approved.

@Aamod-Dev Aamod-Dev 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.

Thanks for putting this together. The code looks clean and solves the issue effectively.

Looks solid. I'll go ahead and approve.

@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 12, 2026
@JhaSourav07 JhaSourav07 merged commit b23db58 into JhaSourav07:main Jun 12, 2026
7 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @realtushartyagi! 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! 💻✨

@Aamod-Dev Aamod-Dev added mentor:Aamod007 type:testing Adding, updating, or fixing tests type:accessibility Accessibility (a11y) improvements and screen reader fixes and removed type:accessibility Accessibility (a11y) improvements and screen reader fixes labels Jun 12, 2026
@Aamod-Dev

Copy link
Copy Markdown
Collaborator

Review Summary
Removed extra type labels ( ype:accessibility) to strictly meet the rule of exactly one type label ( ype:testing retained).

@JhaSourav07 JhaSourav07 added gssoc:approved PR has been reviewed and accepted for valid contribution points and removed gssoc:approved PR has been reviewed and accepted for valid contribution points labels Jun 17, 2026
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:beginner Small changes Usually isolated fixes or simple UI/text updates. 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(index-accessibility): verify Accessibility Standards & Screen Reader Aria Compliance (Variation 4)

4 participants