Skip to content

test(notification-management-token): add unit test coverage (empty-fallback, massive-scaling)#5936

Open
ARPANPATRA111 wants to merge 1 commit into
JhaSourav07:mainfrom
ARPANPATRA111:test/notification-management-token-empty-fallback-v1
Open

test(notification-management-token): add unit test coverage (empty-fallback, massive-scaling)#5936
ARPANPATRA111 wants to merge 1 commit into
JhaSourav07:mainfrom
ARPANPATRA111:test/notification-management-token-empty-fallback-v1

Conversation

@ARPANPATRA111

Copy link
Copy Markdown
Contributor

Description

Fixes #5935

Adds comprehensive test coverage for lib/notification-management-token.ts — the security-critical module handling notification token creation (cryptographic random generation), SHA-256 hashing, extraction from request sources, and timing-safe verification.

Files added

  • lib/notification-management-token.empty-fallback.test.ts (26 tests):

    • createNotificationManagementToken(): prefix/format validation, minimum length, uniqueness
    • hashNotificationManagementToken(): hex output format, determinism, empty string handling
    • getNotificationManagementToken(): header/body/query extraction, priority order (header > body > query), non-string/empty/whitespace body handling, trimming, fallback from managementToken to token query param
    • verifyNotificationManagementToken(): null/empty/undefined inputs, invalid hash format, valid round-trip, mismatched token rejection
  • lib/notification-management-token.massive-scaling.test.ts (5 tests):

    • 10,000-char token hashing
    • Unicode/emoji token hashing
    • 1000 round-trip verifications
    • 1000 unique token generation
    • 100 unique hash generation

Pillar

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

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 started the repo.
  • I have made sure that i have only one commit to merge in this PR.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 17, 2026
@ARPANPATRA111 ARPANPATRA111 force-pushed the test/notification-management-token-empty-fallback-v1 branch from 66e5d3e to 27e6edd Compare June 17, 2026 18:49
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 17, 2026
@github-actions

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 3628.47 KB 3628.47 KB 0 B
Total CSS 284.92 KB 284.92 KB 0 B

@ARPANPATRA111 ARPANPATRA111 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests mentor:Aamod007 labels Jun 18, 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.

Difficulty: intermediate – Adds notification-management-token tests for empty fallback and massive scaling scenarios.

Quality: clean – Edge case & scaling tests.

Type: testing – Robustness coverage.

Solid scaling tests!

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

Labels

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(notification-management-token): add unit test coverage (empty-fallback, error-resilience, massive-scaling)

2 participants