Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
davejcameron committed Aug 3, 2023
1 parent c7400dd commit 3fdd6bf
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/components/CombinationCard/tests/CombinationCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ describe('<CombinationCard />', () => {
});

it.each`
discountClass | selectedChoices | shouldShowBanner
${DiscountClass.Order} | ${['PRODUCT']} | ${true}
${DiscountClass.Order} | ${['ORDER']} | ${true}
${DiscountClass.Order} | ${['SHIPPING']} | ${false}
${DiscountClass.Product} | ${['ORDER']} | ${true}
${DiscountClass.Product} | ${['PRODUCT', 'SHIPPING']} | ${false}
${DiscountClass.Shipping} | ${['PRODUCT', 'ORDER']} | ${false}
discountClass | selectedChoices | bannerCount
${DiscountClass.Order} | ${['PRODUCT']} | ${1}
${DiscountClass.Order} | ${['ORDER']} | ${1}
${DiscountClass.Order} | ${['SHIPPING']} | ${0}
${DiscountClass.Product} | ${['ORDER']} | ${1}
${DiscountClass.Product} | ${['PRODUCT', 'SHIPPING']} | ${0}
${DiscountClass.Shipping} | ${['PRODUCT', 'ORDER']} | ${0}
`(
'renders warning banner conditionally for $discountClass discount and selected choices $selectedChoices',
({discountClass, selectedChoices, shouldShowBanner}) => {
({discountClass, selectedChoices, bannerCount}) => {
const mockPropsWithSelectedChoices = {
...mockProps,
discountClass,
Expand All @@ -289,11 +289,7 @@ describe('<CombinationCard />', () => {
<CombinationCard {...mockPropsWithSelectedChoices} />,
);

if (shouldShowBanner) {
expect(combinationCard).toContainReactComponent(Banner);
} else {
expect(combinationCard).not.toContainReactComponent(Banner);
}
expect(combinationCard.findAll(Banner)).toHaveLength(bannerCount);
},
);
});

0 comments on commit 3fdd6bf

Please sign in to comment.