-
Notifications
You must be signed in to change notification settings - Fork 66
feat: Export isClientEnvironment function #179
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
Conversation
🦋 Changeset detectedLatest commit: 2c7a142 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@jungpaeng is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #179 +/- ##
=======================================
Coverage 99.85% 99.85%
=======================================
Files 15 15
Lines 1337 1340 +3
Branches 260 262 +2
=======================================
+ Hits 1335 1338 +3
Misses 2 2
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your suggestion.
However, since this PR does not completely resolve the issue, I’ve updated the description to ensure the issue is not closed.
|
Understood. Thanks for updating it directly. |
Description
Extract the client-environment check into a new, exported
isClientEnvironment()helper so tests can mock it directly, without changing any runtime behavior or throwing errors.As this is not intended as a patch but rather a small enhancement, I avoided adding any breaking behaviors like throwing errors to ensure full backward compatibility.
Related Issue: #178
Changes
isClientEnvironment()utiluseClientLayoutEffectcall it and return early when false (non-changed behavior)Motivation and Context
Patching
global.navigatorinjest.setup.jsis a pretty good workable solution, but it feels a bit weird and like a global workaround.By extracting and exporting the check, we enable targeted
jest.mock()/jest.spyOn()of exactly that function (and it makes the [overlay-kit] repo itself more testable)While I’m not primarily a frontend engineer and may not be fully familiar with the canonical idioms, I believe this small suggestion maintains full backward compatibility, introduces no runtime changes, and allows for more flexible testing.
How Has This Been Tested?
I didn’t find dedicated tests for this hook, so I’ll check the CI test results after opening the PR.
Screenshots (if appropriate):
Types of changes
Checklist
Further Comments