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

Increase code covergae for OverFlowMenuV2 #17884

Conversation

soumyaraju
Copy link
Contributor

@soumyaraju soumyaraju commented Oct 25, 2024

Closes #17507

Increase code coverage for overflowmenuv2

@soumyaraju soumyaraju requested a review from a team as a code owner October 25, 2024 16:28
Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit d3101c2
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/675755a0f431610008373d0a
😎 Deploy Preview https://deploy-preview-17884--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@soumyaraju soumyaraju changed the title test: overflow menu v2- adding tests Increase code covergae for OverFlowMenuV2 Oct 25, 2024
Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 371a0b1
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/671bc73ba80f26000833057d
😎 Deploy Preview https://deploy-preview-17884--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 371a0b1
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/671bc73b186e6100080ecb1e
😎 Deploy Preview https://deploy-preview-17884--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit d3101c2
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/675755a0bee7e20008b481cb
😎 Deploy Preview https://deploy-preview-17884--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit d3101c2
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/675755a0a490db000836db99
😎 Deploy Preview https://deploy-preview-17884--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.16%. Comparing base (16d3d15) to head (d3101c2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17884      +/-   ##
==========================================
+ Coverage   84.06%   84.16%   +0.09%     
==========================================
  Files         404      404              
  Lines       14350    14350              
  Branches     4599     4599              
==========================================
+ Hits        12064    12077      +13     
+ Misses       2124     2112      -12     
+ Partials      162      161       -1     

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

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for taking a look at this! Rather than mocking the various components, these tests would be more valuable if they ensured the real code works as expected. Meaning if you render() something like what's shown/documented in storybook:

<OverflowMenuV2>
  <CustomMenuItem />
  <MenuItem label="Stop app"  />
  <MenuItemDivider />
  <MenuItem label="Delete app" kind="danger" />
</OverflowMenuV2>

We'd want to assert that

  1. console.warn is called as expected with the deprecation warning
  2. useFeatureFlag('enable-v12-overflowmenu') returns true from within CustomMenuItem
  3. Everything is passed through and spread onto the new implementation of OverflowMenu, meaning new OverflowMenu props such as autoAlign are able to be set and have the proper result (auto align class is present) and the children MenuItem are rendered okay like expect(getByText('Stop app')).toBeInTheDocument();

This way the only thing you'll need to mock is the implementation of console.warn.

@2nikhiltom 2nikhiltom self-assigned this Dec 3, 2024
@soumyaraju
Copy link
Contributor Author

Hi @tay1orjones apologies for the delayed response on this PR. Could you kindly verify if my tests align with your suggestions? Thanks in advance!

@2nikhiltom
Copy link
Contributor

Hey @soumyaraju this looks great, thank you so much for contributing , just two minor things needs attention

@2nikhiltom 2nikhiltom removed their assignment Dec 4, 2024
@soumyaraju
Copy link
Contributor Author

Hey @2nikhiltom, thank you for reviewing it, could you let me know what changes require?

@soumyaraju
Copy link
Contributor Author

Thanks @2nikhiltom for the quick review, i have made the changes, please verify it.

@guidari guidari enabled auto-merge December 6, 2024 16:10
@guidari guidari requested a review from tay1orjones December 6, 2024 16:10
@guidari guidari added this pull request to the merge queue Dec 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 9, 2024
@ariellalgilmore ariellalgilmore added this pull request to the merge queue Dec 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 9, 2024
@2nikhiltom 2nikhiltom added this pull request to the merge queue Dec 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 9, 2024
@ariellalgilmore ariellalgilmore added this pull request to the merge queue Dec 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 9, 2024
@ariellalgilmore ariellalgilmore added this pull request to the merge queue Dec 9, 2024
Merged via the queue into carbon-design-system:main with commit 8502d7a Dec 9, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Increase OverflowMenuV2 unit test coverage
5 participants