Repository navigation
Add tests for network quality hook - #409
Closed
kanaksahu111 wants to merge 5 commits into
Closed
kanaksahu111 wants to merge 5 commits into
kanaksahu111 wants to merge 5 commits into
Conversation
|
@kanaksahu111 is attempting to deploy a commit to the Vicky's projects Team on Vercel. A member of the Team first needs to authorize it. |
👋 Welcome to PACT OS, @kanaksahu111! 🚀Thank you for taking the time to open your first pull request on PACT! We are thrilled to have you here in our open-source community. 🔍 What Happens Next?
📚 Helpful Quick Links
Thank you for helping make PACT better! Plan. Track. Improve. Repeat. 🏛️✨ |
TheVicky1
reviewed
Oct 6, 2026
TheVicky1
left a comment
Owner
There was a problem hiding this comment.
The workflow didn't passed kindly check it and raise a new PR.
Thanks!
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.
🏛️ PACT Pull Request
1. Related Issue
Closes #404
2. Summary of Changes
Implemented a reusable network quality detection hook.
4g,3g,2g,slow-2g)3. Motivation & Context
Applications can provide a better user experience when they know whether the user is offline or connected through a slower network.
This hook provides a reusable way for the application to detect network quality and react to connection changes.
4. Implementation Details
src/hooks/use-network-quality.tsnavigator.onLinefor online/offline statusunknownconnection type when Network Information API data is unavailable2g,slow-2g, andsaveDataonline,offline, and connectionchangeeventstests/use-network-quality.test.tswith mocked browser APIs5. Testing & Local Validation
npm run lint— ESLint passed with 0 errorsnpx tsc --noEmit— TypeScript strict check passed with 0 errorsnpm test(ornode scratch/run-tests.mjs) — test matrix passednpm run test:file -- <file>— targeted test suite passednode scratch/secret-scan.mjs— Zero secrets or sensitive credentials detectednpm run build— Production build succeeded without errorsTesting was not run locally because the contribution was made through the GitHub web editor.
6. UI & Visual Changes
7. Database & Security Impact
8. Documentation Impact
9. Contributor Quality Checklist
.env.localfiles are included in this PR.upstream/mainwith an appropriate prefix (e.g.,feat/,fix/,docs/,ui/).type(scope): description).git diffto ensure no stray files or debugging artifacts were committed.10. Reviewer Notes
The implementation follows the existing browser-hook pattern in the repository and keeps the network detection logic reusable for future features.