Skip to content

Commit 47d897d

Browse files
author
George Haberis
committed
add unit test
1 parent c905601 commit 47d897d

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

dotcom-rendering/src/model/enhance-product-summary.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,4 +315,46 @@ describe('enhanceProductSummary', () => {
315315

316316
expect(stacked).toBeUndefined();
317317
});
318+
319+
it('does not return stacked cards when the filterAtAGlance switch is OFF', () => {
320+
const allowedPageId =
321+
'thefilter/test-article-example-for-product-summary';
322+
323+
const input = [
324+
atAGlanceHeading(),
325+
linkElement(
326+
'https://www.homebase.co.uk/en-uk/tower-airx-t17166-5l-grey-single-basket-air-fryer-digital-air-fryer/p/0757395',
327+
'Buy now',
328+
),
329+
linkElement(
330+
'https://www.lakeland.co.uk/27537/lakeland-slimline-air-fryer-black-8l',
331+
'Buy now',
332+
),
333+
linkElement(
334+
'https://ninjakitchen.co.uk/product/ninja-double-stack-xl-9-5l-air-fryer-sl400uk-zidSL400UK',
335+
'Buy now',
336+
),
337+
dividerElement(),
338+
productElement([
339+
'https://www.homebase.co.uk/en-uk/tower-airx-t17166-5l-grey-single-basket-air-fryer-digital-air-fryer/p/0757395',
340+
]),
341+
productElement([
342+
'https://www.lakeland.co.uk/27537/lakeland-slimline-air-fryer-black-8l',
343+
]),
344+
productElement([
345+
'https://ninjakitchen.co.uk/product/ninja-double-stack-xl-9-5l-air-fryer-sl400uk-zidSL400UK',
346+
]),
347+
];
348+
349+
const output = enhanceProductSummary({
350+
pageId: allowedPageId,
351+
serverSideABTests: { 'thefilter-at-a-glance-redesign': 'stacked' },
352+
renderingTarget: 'Web',
353+
filterAtAGlanceEnabled: false,
354+
})(input);
355+
356+
const stacked = findStacked(output);
357+
358+
expect(stacked).toBeUndefined();
359+
});
318360
});

0 commit comments

Comments
 (0)