Skip to content
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

WRQ-12037: Investigate how to mock core/platform and webos/platform i… #1605

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

vJIYEv
Copy link
Contributor

@vJIYEv vJIYEv commented May 2, 2024

Checklist

  • I have read and understand the contribution guide
  • A CHANGELOG entry is included
  • At least one test case is included for this feature or bug fix
  • Documentation was added or is not needed
  • This is an API breaking change

Issue Resolved / Feature Added

Enact libraries like Sandstone have a few code to work on specific browser versions or specific platform environments but we don't test those logics in unit tests due to lack of mocking.
So we should investigate how to mock core/platform and webos/platform in unit tests

Resolution

We can mock "userAgent" of globalThis.navigator using "Object.defineProperty".
Because core/platform and webos/platform get platform information by parsing user agent, mocking user agent is same with mocking platform.
I added "InputField" unit test for example.

Additional Considerations

Links

WRQ-12037

Comments

Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com)

…n Sandstone's unit tests

Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com)
Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.58%. Comparing base (612b167) to head (fee4d3f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1605      +/-   ##
===========================================
+ Coverage    81.51%   81.58%   +0.07%     
===========================================
  Files          148      148              
  Lines         6631     6631              
  Branches      1957     1957              
===========================================
+ Hits          5405     5410       +5     
+ Misses         933      930       -3     
+ Partials       293      291       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vJIYEv
Copy link
Contributor Author

vJIYEv commented May 13, 2024

Travis error occurs because enactjs/enact#3233 is not merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant