-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PWA-1002] Increase Test Coverage in venia-ui/lib/components/Checkout…
…Page (#3018) * Add additional coverage to CheckoutPage components * Bail on component manual mocks for now until warning can be suppressed * Minor cleanup to mock names Co-authored-by: Devagouda <40405790+dpatil-magento@users.noreply.github.com>
- Loading branch information
1 parent
8697834
commit 012f2db
Showing
6 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...ib/components/CheckoutPage/OrderSummary/__tests__/__snapshots__/orderSummary.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders order summary 1`] = ` | ||
<div | ||
className="root" | ||
> | ||
<h1 | ||
className="title" | ||
> | ||
<mock-FormattedMessage | ||
defaultMessage="Order Summary" | ||
id="checkoutPage.orderSummary" | ||
/> | ||
</h1> | ||
<PriceSummary | ||
isUpdating={[MockFunction isUpdating]} | ||
/> | ||
</div> | ||
`; |
16 changes: 16 additions & 0 deletions
16
packages/venia-ui/lib/components/CheckoutPage/OrderSummary/__tests__/orderSummary.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { createTestInstance } from '@magento/peregrine'; | ||
|
||
import OrderSummary from '../orderSummary'; | ||
|
||
jest.mock('../../../../classify'); | ||
jest.mock('../../../CartPage/PriceSummary', () => 'PriceSummary'); | ||
|
||
test('renders order summary', () => { | ||
const mockIsUpdating = jest.fn().mockName('isUpdating'); | ||
const tree = createTestInstance( | ||
<OrderSummary isUpdating={mockIsUpdating} /> | ||
); | ||
|
||
expect(tree.toJSON()).toMatchSnapshot(); | ||
}); |
29 changes: 29 additions & 0 deletions
29
...nents/CheckoutPage/PriceAdjustments/__tests__/__snapshots__/priceAdjustments.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`renders price adjustments 1`] = ` | ||
<div | ||
className="root" | ||
> | ||
<mock-Accordion | ||
canOpenMultiple={true} | ||
> | ||
<mock-Section | ||
id="coupon_code" | ||
title="Enter Coupon Code" | ||
> | ||
<CouponCode | ||
setIsCartUpdating={[MockFunction setPageIsUpdating]} | ||
/> | ||
</mock-Section> | ||
<GiftCardSection | ||
setIsCartUpdating={[MockFunction setPageIsUpdating]} | ||
/> | ||
<mock-Section | ||
id="gift_options" | ||
title="See Gift Options" | ||
> | ||
<GiftOptions /> | ||
</mock-Section> | ||
</mock-Accordion> | ||
</div> | ||
`; |
28 changes: 28 additions & 0 deletions
28
.../venia-ui/lib/components/CheckoutPage/PriceAdjustments/__tests__/priceAdjustments.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { createTestInstance } from '@magento/peregrine'; | ||
|
||
import PriceAdjustments from '../priceAdjustments'; | ||
|
||
jest.mock('../../../../classify'); | ||
jest.mock('../../../Accordion', () => ({ | ||
Accordion: props => <mock-Accordion {...props} />, | ||
Section: props => <mock-Section {...props} /> | ||
})); | ||
jest.mock('../../../CartPage/PriceAdjustments/CouponCode', () => 'CouponCode'); | ||
jest.mock( | ||
'../../../CartPage/PriceAdjustments/giftCardSection', | ||
() => 'GiftCardSection' | ||
); | ||
jest.mock( | ||
'../../../CartPage/PriceAdjustments/GiftOptions', | ||
() => 'GiftOptions' | ||
); | ||
|
||
test('renders price adjustments', () => { | ||
const mockSetPageIsUpdating = jest.fn().mockName('setPageIsUpdating'); | ||
const tree = createTestInstance( | ||
<PriceAdjustments setPageIsUpdating={mockSetPageIsUpdating} /> | ||
); | ||
|
||
expect(tree.toJSON()).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters