test(notification-management-token): add unit test coverage (empty-fallback, massive-scaling)#5936
Open
ARPANPATRA111 wants to merge 1 commit into
Conversation
…llback, massive-scaling)
66e5d3e to
27e6edd
Compare
Contributor
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
ARPANPATRA111
commented
Jun 17, 2026
ARPANPATRA111
left a comment
Contributor
Author
There was a problem hiding this comment.
@Aamod007 @souravjhahind @JhaSourav07 review and merge
Aamod007
approved these changes
Jun 18, 2026
Aamod007
left a comment
Collaborator
There was a problem hiding this comment.
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!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, uniquenesshashNotificationManagementToken(): hex output format, determinism, empty string handlinggetNotificationManagementToken(): header/body/query extraction, priority order (header > body > query), non-string/empty/whitespace body handling, trimming, fallback frommanagementTokentotokenquery paramverifyNotificationManagementToken(): null/empty/undefined inputs, invalid hash format, valid round-trip, mismatched token rejectionlib/notification-management-token.massive-scaling.test.ts(5 tests):Pillar
Checklist before requesting a review:
CONTRIBUTING.mdfile.npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).