-
Notifications
You must be signed in to change notification settings - Fork 687
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
[PWA-1002] Increase Test Coverage in venia-ui/lib/components/CheckoutPage #3018
Conversation
@@ -0,0 +1,12 @@ | |||
import React from 'react'; | |||
|
|||
const MockAccordion = jest.fn(({ children, ...props }) => ( |
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.
I did this after discussions from peer review; that our components would benefit from more manual mocks. Would like to discuss this further, but provided manual mocks like these is pretty simple, but not necessary.
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.
I may have stumbled onto why we haven't embraced this more. It seems some very old Jest bug causes these duplicate mock warnings, because jest-haste-map
stores these mocks by name and not by path. Given we're a project where we use index files to export public API, I can see how this warning may have scared us away from manual mocks, since all of these module names would be index.
I'm digging for a solution, but nothing seems to be working. As you can see, the tests function fine, there's just this very in your face warning you get the first time you run the suite. We could mock underlying components instead of index exports, but expect we'd run into a similar issue eventually.
Original Bug: jestjs/jest#2070
The warning:
jest-haste-map: duplicate manual mock found: index
The following files share their name; please delete one of them:
* <rootDir>/packages/peregrine/lib/RestApi/__mocks__/index.js
* <rootDir>/packages/venia-ui/lib/components/Accordion/__mocks__/index.js
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.
Went ahead and just pulled this out, can disregard.
|
I haven't looked, but I really hope there aren't too many conflicts with #2969 |
Description
As part of our initiative to increase test coverage, stability and confidence in our project we've identified this folder as having a lower than acceptable level of test coverage.
Acceptance Criteria:
Increase test coverage to an acceptable level, ideally 100%
Implementation Note
There was a component in here
brainTreeDropIn
that I didn't feel comfortable trying to cover. It relied on a lot of waterfall async work to render that wasn't straight forward, so might be better to tap on the original develop for covering that file. Could also be an opportunity to re-visit and see if patterns we've started coalescing on could be added to this component to help simplify.Related Issue
Acceptance
Verification Stakeholders
Specification
Verification Steps
Screenshots / Screen Captures (if appropriate)
Checklist