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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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 dc8a21f
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/671ca49616a1250008896b55
😎 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 dc8a21f
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/671ca4960f23800008fcf4ef
😎 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 dc8a21f
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/671ca496ec1b000008265646
😎 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 80.48%. Comparing base (114c71e) to head (dc8a21f).
Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17884      +/-   ##
==========================================
+ Coverage   80.35%   80.48%   +0.13%     
==========================================
  Files         406      406              
  Lines       14041    14041              
  Branches     4395     4367      -28     
==========================================
+ Hits        11282    11301      +19     
+ Misses       2593     2574      -19     
  Partials      166      166              

☔ 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.

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.

Increase OverflowMenuV2 unit test coverage
2 participants