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

CIF-1436 - Can't remove or edit items from shopping cart #314

Merged
merged 4 commits into from
Jun 23, 2020

Conversation

dplaton
Copy link
Contributor

@dplaton dplaton commented Jun 22, 2020

Description

The problem was caused by the minicart refactoring that we've done some time ago - when the first product is added to the cart the "handlers" were not initialized. I removed the "cart handler" methods and use the actions directly.

The same problem affects the coupons feature - both "Add coupon" and "Remove coupon" were broken because of the same issue. The same fix has been applied to those as well.

Related Issue

CIF-1436

Motivation and Context

Fix the shopping cart functionality

How Has This Been Tested?

Functional testing

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

The problem was caused by the minicart refactoring that we've done some time ago - when the first product is added to the cart the "handlers" were not initialized. I removed the "cart handler" methods and use the actions directly.

The same problem affects the coupons feature - both "Add coupon" and "Remove coupon" were broken because of the same issue. The same fix has been applied to those as well.
@dplaton dplaton added the bug Something isn't working label Jun 22, 2020
Copy link
Member

@herzog31 herzog31 left a comment

Choose a reason for hiding this comment

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

Looks nice and very clean 👍

</I18nextProvider>
);
expect(asFragment()).toMatchSnapshot();
});

it('applies an coupon', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Since we don't have E2E tests, I would like to keep the tests that make sure that clicks on "Apply coupon" calls the useCouponForm resp. "Remove coupon" calls the useCouponItem hooks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of implementing some tests for the useXXX "hooks" I added, but you're right, we still need to test the wiring here.

@codecov
Copy link

codecov bot commented Jun 22, 2020

Codecov Report

Merging #314 into master will increase coverage by 0.26%.
The diff coverage is 89.18%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #314      +/-   ##
============================================
+ Coverage     64.62%   64.88%   +0.26%     
  Complexity      809      809              
============================================
  Files           181      184       +3     
  Lines          5631     5639       +8     
  Branches        875      875              
============================================
+ Hits           3639     3659      +20     
+ Misses         1864     1852      -12     
  Partials        128      128              
Flag Coverage Δ Complexity Δ
#jest 43.02% <89.18%> (+0.58%) 0.00 <0.00> (ø)
#karma 94.51% <ø> (ø) 0.00 <ø> (ø)
#unittests 85.77% <ø> (ø) 809.00 <ø> (ø)
Impacted Files Coverage Δ Complexity Δ
...-components/src/components/Minicart/cartContext.js 77.27% <ø> (+3.35%) 0.00 <0.00> (ø)
...t-components/src/components/Minicart/useProduct.js 66.66% <66.66%> (ø) 0.00 <0.00> (?)
...ponents/src/components/Minicart/cartInitializer.js 81.25% <100.00%> (+25.36%) 0.00 <0.00> (ø)
...t-components/src/components/Minicart/couponForm.js 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...t-components/src/components/Minicart/couponItem.js 100.00% <100.00%> (ø) 0.00 <0.00> (ø)
...eact-components/src/components/Minicart/product.js 88.88% <100.00%> (+8.88%) 0.00 <0.00> (ø)
...omponents/src/components/Minicart/useCouponForm.js 100.00% <100.00%> (ø) 0.00 <0.00> (?)
...omponents/src/components/Minicart/useCouponItem.js 100.00% <100.00%> (ø) 0.00 <0.00> (?)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68ded2c...af86b50. Read the comment docs.

@herzog31 herzog31 merged commit bcaa9b6 into master Jun 23, 2020
@herzog31 herzog31 deleted the issues/CIF-1436 branch June 23, 2020 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants