-
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
Increase test coverage for packages/peregrine/lib/talons/CheckoutPage
#3024
Increase test coverage for packages/peregrine/lib/talons/CheckoutPage
#3024
Conversation
|
I'm seeing some test failures when running |
The untestable places seem like refactor targets if they're easy enough to fix up and the logic is identical. What do you thnink? |
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.
Would be good to do a quick merge from dev to ensure the test coverage remains. Also had a thought about mocking queries that generally applies to any places you used that style in these tests. Regardless, I'll approve now and let you decide how to proceed.
useMutation.mockImplementation(query => { | ||
let result = [jest.fn(), { error: null }]; | ||
|
||
switch (query) { | ||
case 'createAccountMutation': | ||
result = [mockCreateAccount, { error: null }]; | ||
break; | ||
case 'signInMutation': | ||
result = [mockSignIn, { error: null }]; | ||
break; | ||
} | ||
|
||
return result; | ||
}); |
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.
Did you try using the new query mocking approach, like here?
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.
Bueno
Description
Increase coverage for files under
packages/peregrine/lib/talons/CheckoutPage
NOTE:
The uncovered lines in the report represent branching logic paths that appear to be unreachable.
Line 12 in
CheckoutPage/AddressBook/useAddressCard.js
: Address cannot be undefined because the destructuring in Line 5 would cause an error before it could reach Line 12.Line 132 in
CheckoutPage/PaymentInformation/useCreditCard.js
: Cannot test the (false
||true
) path for this line since the only timedropInLoading
is set tofalse
, thestepNumber
is always set to 0.Related Issue
Closes PWA-996
Acceptance
any developer
Verification Stakeholders
any developer
Specification
Verification Steps
yarn test --collectCoverageFrom="packages/peregrine/lib/talons/CheckoutPage/**/*.js" packages/peregrine/lib/talons/CheckoutPage/
Screenshots / Screen Captures (if appropriate)
Checklist