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 #3233

Open
wants to merge 5 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

I added an example unit test here (enactjs/sandstone#1605) to show how to mock core/platform or webos/platform.
We can mock core/platform or webos/platform by parsing "mock userAgent".
By the way, if platform information is detected once by parsing user agent, "detectedPlatform" is used after that.
We can't test multiple platform in one unit test file.
So I made "resetPlatformDescription" function to reset detected platform information.

Additional Considerations

Links

WRQ-12037

Comments

Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])

…n Sandstone's unit tests

Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])
Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.42%. Comparing base (da7050c) to head (95eecc8).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3233       /-   ##
===========================================
  Coverage    82.36%   82.42%    0.06%     
===========================================
  Files          156      156              
  Lines         7209     7211        2     
  Branches      1907     1907              
===========================================
  Hits          5938     8634        6     
  Misses         999      997       -2     
  Partials       272      270       -2     

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

vJIYEv added 4 commits May 2, 2024 16:09
Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])
Enact-DCO-1.0-Signed-off-by: Jiye Kim ([email protected])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant