-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add unit test for src/utils/server/responsive.ts #5911
base: main
Are you sure you want to change the base?
test: add unit test for src/utils/server/responsive.ts #5911
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
👍 @gru-agent[bot] Thank you for raising your pull request and contributing to our Community |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5911 +/- ##
=========================================
Coverage 92.13% 92.13%
=========================================
Files 650 651 +1
Lines 59053 59098 +45
Branches 2925 4094 +1169
=========================================
+ Hits 54406 54451 +45
Misses 4647 4647
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
✅ Rebase TestGru PR Success
|
🔄 Rebasing Testgru per ... |
6abb989
to
b982300
Compare
✅ Rebase TestGru PR Success
|
b982300
to
c95b203
Compare
🔄 Rebasing Testgru per ... |
✅ Rebase TestGru PR Success
|
c95b203
to
f32b7b8
Compare
Deployment failed with the following error:
|
🔄 Rebasing Testgru per ... |
✅ Rebase TestGru PR Success
|
🔄 Rebasing Testgru per ... |
f32b7b8
to
4890ac0
Compare
Deployment failed with the following error:
|
Trigger Info
Summary
This PR introduces unit tests for the
isMobileDevice
andgerServerDeviceInfo
functions in theresponsive.ts
module. Key changes include:Unit Tests:
Added tests for
isMobileDevice
to verify:Correct detection of mobile devices based on the
user-agent
header.Proper error handling when the function is called outside a server environment.
Added tests for
gerServerDeviceInfo
to verify:Accurate extraction of device information (browser, OS, and mobile status).
Proper error handling when the function is called outside a server environment.
Mocking:
next/headers
module to simulate server-side behavior and provide a customuser-agent
header for testing.Export Fix:
isMobileDevice
is explicitly exported fromresponsive.ts
.These changes improve test coverage and ensure the reliability of server-side device detection functionality.
Tip
You can
@gru-agent
and leave your feedback. TestGru will make adjustments based on your inputTip
You can
@gru-agent rebase
to rebase the PR.Tip
You can
@gru-agent redo
to reset or rebase before redoing the PR.Tip
To modify the test code yourself, click here Edit Test Code