-
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-1005: Increase Test Coverage in venia-ui/lib/components/Main #3004
Conversation
- add tests to assert correct rendering of each use case
|
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.
Tiny suggestion for an additional test.
|
||
expect(root.findByProps({ className: 'root' })).toBeTruthy(); | ||
expect(root.findByProps({ className: 'page' })).toBeTruthy(); | ||
}); |
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 know there's some debate about the value of snapshot tests, but I feel like we currently use them to detect breaking changes. I'm not locked into that mindset so I would consider either a snapshot test here, or a simple test to verify the children
prop to rendered.
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.
For what it's worth I suggested that @anthoula use these direct props assertions rather than snapshots. Your request about rendering the children is still valid though!
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.
Nice! Worth talking about at next peer review/team time then. Snapshot tests can serve a purpose, but we should probably not call them unit tests.
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.
Yep, originally had snapshot assertions, as that seems to be a current convention widely in use. Added an additional assertion for rendered children
Description
Increase test coverage for the
Main
component.Related Issue
https://jira.corp.magento.com/browse/PWA-1005
Acceptance
Any developer
Verification Stakeholders
Any developer
Specification
Verification Steps
yarn test --collectCoverageFrom=**/main.js packages/venia-ui/lib/components/Main/
Screenshots / Screen Captures (if appropriate)
Checklist