Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/app/frontend/js/containers/product/ProductCardContainer/index.spec.jsx b/app/frontend/js/containers/product/ProductCardContainer/index.spec.jsx
- index 4eb46cebf8..345f54eb50 100644
- --- a/app/frontend/js/containers/product/ProductCardContainer/index.spec.jsx
- +++ b/app/frontend/js/containers/product/ProductCardContainer/index.spec.jsx
- @@ -12,12 +12,13 @@ import * as tracking from '../../../utils/tracking'
- import * as experiments from '../../../utils/experiments'
- import { getVariantListImages } from '../../../models/variant'
- import { UnconnectedProductCardContainer } from '.'
- -
- +import { checkPageLocation } from '../../../utils/location'
- jest.mock('../../../utils/env')
- jest.mock('../../../utils/featureFlags')
- jest.mock('../../../utils/tracking')
- jest.mock('../../../models/variant')
- jest.mock('../../../utils/experiments')
- +jest.mock('../../../utils/location')
- describe('ProductCardContainer', () => {
- beforeEach(() => {
- @@ -387,6 +388,9 @@ describe('ProductCardContainer', () => {
- when(experiments.findExperiment)
- .calledWith('pdp_variant_preselect')
- .mockReturnValue({ alternative: 'control:no_preselect' })
- + })
- +
- + test('it calls experimentViewed on render', () => {
- const wrapper = shallow(
- <UnconnectedProductCardContainer
- product={{ ...boyBrow, isInitial: true }}
- @@ -395,9 +399,6 @@ describe('ProductCardContainer', () => {
- icon={13}
- />
- )
- - })
- -
- - test('it calls experimentViewed on render', () => {
- expect(tracking.experimentViewed).toHaveBeenCalledWith(
- 'pdp_variant_preselect',
- 'control:no_preselect'
- @@ -410,6 +411,12 @@ describe('ProductCardContainer', () => {
- when(experiments.findExperiment)
- .calledWith('pdp_variant_preselect')
- .mockReturnValue({ alternative: 'variant:preselect' })
- + when(checkPageLocation)
- + .calledWith('/products')
- + .mockReturnValue(true)
- + })
- +
- + test('it calls experimentViewed on render', () => {
- const wrapper = shallow(
- <UnconnectedProductCardContainer
- product={{ ...boyBrow, isInitial: true }}
- @@ -418,13 +425,23 @@ describe('ProductCardContainer', () => {
- icon={13}
- />
- )
- - })
- -
- - test('it calls experimentViewed on render', () => {
- expect(tracking.experimentViewed).toHaveBeenCalledWith(
- 'pdp_variant_preselect',
- 'variant:preselect'
- )
- })
- +
- + test('it displays the correct selected variant', () => {
- + const wrapper = shallow(
- + <UnconnectedProductCardContainer
- + product={boyBrow}
- + addToBag={noop}
- + listId="list"
- + icon={13}
- + />
- + )
- + wrapper.instance().setInitialSelection()
- + expect(wrapper.state().selectedVariant.sku).toBe('BBR-008-00-00')
- + })
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement