From 609f68a111f013047f8a09268103fdde91508fed Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Tue, 18 Aug 2026 12:55:46 +0100 Subject: [PATCH 1/7] Use variant headline when in editorial test --- .../src/model/enhanceCards.test.ts | 121 +++++++++++++++++- dotcom-rendering/src/model/enhanceCards.ts | 57 ++++++++- .../src/model/enhanceCollections.ts | 5 + dotcom-rendering/src/model/groupCards.ts | 3 + .../src/server/handler.front.web.ts | 2 + 5 files changed, 186 insertions(+), 2 deletions(-) diff --git a/dotcom-rendering/src/model/enhanceCards.test.ts b/dotcom-rendering/src/model/enhanceCards.test.ts index bbe0c8e3aa2..bde13dedab1 100644 --- a/dotcom-rendering/src/model/enhanceCards.test.ts +++ b/dotcom-rendering/src/model/enhanceCards.test.ts @@ -1,8 +1,14 @@ -import type { FEMediaAsset, FEMediaAtom } from '../frontend/feFront'; +import type { + FEFrontCardStyle, + FEMediaAsset, + FEMediaAtom, +} from '../frontend/feFront'; import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat'; +import type { VariantMeta } from '../types/front'; import type { MainMedia } from '../types/mainMedia'; import { decideArticleMedia, + decideHeadline, decideReplacementMedia, getActiveMediaAtom, getMediaMetadata, @@ -527,4 +533,117 @@ describe('Enhance Cards', () => { }); }); }); + + describe('decideHeadline', () => { + const cardWithNoEditorialTest = { + properties: { + isBreaking: false, + showKickerTag: false, + showByline: false, + isLiveBlog: false, + isCrossword: false, + webTitle: '', + editionBrandings: [], + tests: [], + }, + header: { + isVideo: false, + isComment: false, + isGallery: false, + isAudio: false, + headline: 'Headline', + url: '', + hasMainVideoElement: false, + }, + card: { + id: '', + cardStyle: { + type: 'DefaultCardstyle' as FEFrontCardStyle, + }, + shortUrl: '', + group: '', + isLive: false, + }, + discussion: { + isCommentable: false, + isClosedForComments: false, + }, + display: { + isBoosted: false, + showBoostedHeadline: false, + showQuotedHeadline: false, + imageHide: false, + showLivePlayable: false, + }, + type: '', + }; + + const oneHourInMilliseconds = 60 * 60 * 1000; + + const cardWithEditorialTest = { + ...cardWithNoEditorialTest, + properties: { + ...cardWithNoEditorialTest.properties, + tests: [ + { + testUuid: 'uuid', + variantMeta: [ + { + id: 'A', + meta: { + headline: 'Headline A', + }, + }, + { + id: 'B', + meta: { + headline: 'Headline B', + }, + }, + ] as VariantMeta[], + startDate: Date.now() - oneHourInMilliseconds, + expiryDate: Date.now() + oneHourInMilliseconds, + frontsThisTestCanRunOn: [], + hasManuallyEndedOnThisTrail: false, + }, + ], + }, + }; + + it('returns the default headline if no editorial test exists on the card and user is not in a test bucket', () => { + expect(decideHeadline(cardWithNoEditorialTest, {})).toEqual( + 'Headline', + ); + }); + + it('returns the default headline if editorial test exists but user is not in a test bucket', () => { + expect(decideHeadline(cardWithEditorialTest, {})).toEqual( + 'Headline', + ); + }); + + it('returns the default headline if editorial test does not exist but user is in a test bucket', () => { + expect( + decideHeadline(cardWithNoEditorialTest, { + 'fronts-and-curation-editorial-headline-test': 'a', + }), + ).toEqual('Headline'); + }); + + it('returns headline A if editorial test exists and user is in bucket A', () => { + expect( + decideHeadline(cardWithEditorialTest, { + 'fronts-and-curation-editorial-headline-test': 'a', + }), + ).toEqual('Headline A'); + }); + + it('returns headline B if editorial test exists and user is in bucket B', () => { + expect( + decideHeadline(cardWithEditorialTest, { + 'fronts-and-curation-editorial-headline-test': 'b', + }), + ).toEqual('Headline B'); + }); + }); }); diff --git a/dotcom-rendering/src/model/enhanceCards.ts b/dotcom-rendering/src/model/enhanceCards.ts index 7a67fe1eeca..0b3546380c1 100644 --- a/dotcom-rendering/src/model/enhanceCards.ts +++ b/dotcom-rendering/src/model/enhanceCards.ts @@ -25,6 +25,7 @@ import type { DCRFrontCard, DCRSlideshowImage, DCRSupportingContent, + EditorialTest, } from '../types/front'; import type { ArticleMedia, MainMedia } from '../types/mainMedia'; import type { PodcastSeriesImage, TagType } from '../types/tag'; @@ -183,6 +184,56 @@ const decideVideoAtomImage = ( return undefined; }; +/** + * Checks if an editorial test is active by making sure it has not been manually ended, + * that it has a valid expiry date, and that the expiry date is in the future + */ +const isActiveEditorialTest = (test: EditorialTest) => + !test.hasManuallyEndedOnThisTrail && + !!test.expiryDate && + test.expiryDate > Date.now(); + +/** + * Looks through a list of editorial tests to see if there is an active test. If no active + * test is found, return undefined + */ +const findActiveEditorialTest = ( + tests: EditorialTest[] | undefined, +): EditorialTest | undefined => { + return tests?.find((test) => isActiveEditorialTest(test)); +}; + +/** + * Decide the headline to be shown for a given card. If there is an active editorial test on a card, + * return the variant headline matching the user test group. Otherwise, return the default headline + */ +export const decideHeadline = ( + faciaCard: FEFrontCard, + serverSideABTests: Record, +): string => { + const activeEditorialTest = findActiveEditorialTest( + faciaCard.properties.tests, + ); + + // return default headline if there is no editorial test on the card + if (!activeEditorialTest) { + return faciaCard.header.headline; + } + + const testBucket = + serverSideABTests?.['fronts-and-curation-editorial-headline-test']; + + // return a different variant headline for each test bucket, or return the default + // headline if not in a test bucket + if (testBucket === 'a') { + return String(activeEditorialTest.variantMeta[0]?.meta.headline); + } else if (testBucket === 'b') { + return String(activeEditorialTest.variantMeta[1]?.meta.headline); + } else { + return faciaCard.header.headline; + } +}; + /** * While the first Media Atom is *not* guaranteed to be the main media, * it *happens to be* correct in the majority of cases. @@ -363,6 +414,7 @@ export const enhanceCards = ( pageId, discussionApiUrl, stripBranding = false, + serverSideABTests, }: { cardInTagPage: boolean; /** Used for the data link name to indicate card position in container */ @@ -372,6 +424,7 @@ export const enhanceCards = ( discussionApiUrl: string; /** We strip branding from cards if the branding will appear at the collection level instead */ stripBranding?: boolean; + serverSideABTests: Record; }, ): DCRFrontCard[] => collections.map((faciaCard, index) => { @@ -448,7 +501,8 @@ export const enhanceCards = ( format, dataLinkName, url: decideUrl(faciaCard), - headline: faciaCard.header.headline, + // TODO - respect value of frontsThisTestCanRunOn - compare value of pageId + headline: decideHeadline(faciaCard, serverSideABTests), trailText: faciaCard.card.trailText, starRating: faciaCard.card.starRating, webPublicationDate: !isUndefined( @@ -507,5 +561,6 @@ export const enhanceCards = ( ?.allImages[0]?.fields.altText ?? '', }, }), + tests: faciaCard.properties.tests, }; }); diff --git a/dotcom-rendering/src/model/enhanceCollections.ts b/dotcom-rendering/src/model/enhanceCollections.ts index 1fefac96915..7efe9aaa2ca 100644 --- a/dotcom-rendering/src/model/enhanceCollections.ts +++ b/dotcom-rendering/src/model/enhanceCollections.ts @@ -54,6 +54,7 @@ export const enhanceCollections = ({ frontBranding, onPageDescription, isOnPaidContentFront, + serverSideABTests, }: { collections: FECollection[]; editionId: EditionId; @@ -62,6 +63,7 @@ export const enhanceCollections = ({ frontBranding: Branding | undefined; onPageDescription?: string; isOnPaidContentFront?: boolean; + serverSideABTests: Record; }): DCRCollectionType[] => { const indexToShowFrontBranding = findCollectionSuitableForFrontBranding(collections); @@ -128,18 +130,21 @@ export const enhanceCollections = ({ editionId, discussionApiUrl, stripBrandingFromCards, + serverSideABTests, ), curated: enhanceCards(collection.curated, { cardInTagPage: false, editionId, discussionApiUrl, stripBranding: stripBrandingFromCards, + serverSideABTests, }), backfill: enhanceCards(collection.backfill, { cardInTagPage: false, editionId, discussionApiUrl, stripBranding: stripBrandingFromCards, + serverSideABTests, }), treats: enhanceTreats( collection.treats, diff --git a/dotcom-rendering/src/model/groupCards.ts b/dotcom-rendering/src/model/groupCards.ts index db1be083621..332c95621a3 100644 --- a/dotcom-rendering/src/model/groupCards.ts +++ b/dotcom-rendering/src/model/groupCards.ts @@ -25,6 +25,7 @@ export const groupCards = ( editionId: EditionId, discussionApiUrl: string, stripBranding: boolean = false, + serverSideABTests: Record, ): DCRGroupedTrails => { switch (container) { case 'flexible/general': { @@ -45,6 +46,7 @@ export const groupCards = ( discussionApiUrl, offset, stripBranding, + serverSideABTests, }); return { @@ -67,6 +69,7 @@ export const groupCards = ( discussionApiUrl, offset, stripBranding, + serverSideABTests, }); return { diff --git a/dotcom-rendering/src/server/handler.front.web.ts b/dotcom-rendering/src/server/handler.front.web.ts index 6e94ff02f33..1ce0925d6de 100644 --- a/dotcom-rendering/src/server/handler.front.web.ts +++ b/dotcom-rendering/src/server/handler.front.web.ts @@ -35,6 +35,7 @@ const enhanceFront = (body: unknown): Front => { data.pressedPage.frontProperties.commercial.editionBrandings, data.editionId, ), + serverSideABTests: data.config.serverSideABTests, }); return { @@ -122,6 +123,7 @@ const enhanceTagPage = (body: unknown): TagPage => { discussionApiUrl: data.config.discussionApiUrl, editionId: data.editionId, stripBranding: !!tagPageBranding, + serverSideABTests: data.config.serverSideABTests, }); const speed = getSpeedFromTrails(data.contents); From 5b402fbb553c9a2f17226ef78d5b3df53f79d272 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Tue, 18 Aug 2026 16:28:22 +0100 Subject: [PATCH 2/7] Only run test headlines on fronts listed in 'frontsThisTestCanRunOn' --- .../src/model/enhanceCards.test.ts | 70 +++++++++++++------ dotcom-rendering/src/model/enhanceCards.ts | 37 +++++----- .../src/model/enhanceCollections.ts | 3 + dotcom-rendering/src/model/groupCards.ts | 3 + 4 files changed, 75 insertions(+), 38 deletions(-) diff --git a/dotcom-rendering/src/model/enhanceCards.test.ts b/dotcom-rendering/src/model/enhanceCards.test.ts index bde13dedab1..11f7c1f6fb9 100644 --- a/dotcom-rendering/src/model/enhanceCards.test.ts +++ b/dotcom-rendering/src/model/enhanceCards.test.ts @@ -603,46 +603,74 @@ describe('Enhance Cards', () => { ] as VariantMeta[], startDate: Date.now() - oneHourInMilliseconds, expiryDate: Date.now() + oneHourInMilliseconds, - frontsThisTestCanRunOn: [], + frontsThisTestCanRunOn: ['test-front'], hasManuallyEndedOnThisTrail: false, }, ], }, }; - it('returns the default headline if no editorial test exists on the card and user is not in a test bucket', () => { - expect(decideHeadline(cardWithNoEditorialTest, {})).toEqual( - 'Headline', - ); + it('returns the default headline if no editorial test exists on the card, page is not in allowed fronts list, and user is not in a test bucket', () => { + expect( + decideHeadline( + cardWithNoEditorialTest, + {}, + 'invalid-test-front', + ), + ).toEqual('Headline'); }); - it('returns the default headline if editorial test exists but user is not in a test bucket', () => { - expect(decideHeadline(cardWithEditorialTest, {})).toEqual( - 'Headline', - ); + it('returns the default headline if editorial test exists and page is in allowed fronts list, but user is not in a test bucket', () => { + expect( + decideHeadline(cardWithEditorialTest, {}, 'test-front'), + ).toEqual('Headline'); }); - it('returns the default headline if editorial test does not exist but user is in a test bucket', () => { + it('returns the default headline if user is in a test bucket and page is in allowed fronts list, but editorial test does not exist', () => { expect( - decideHeadline(cardWithNoEditorialTest, { - 'fronts-and-curation-editorial-headline-test': 'a', - }), + decideHeadline( + cardWithNoEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'a', + }, + 'test-front', + ), ).toEqual('Headline'); }); - it('returns headline A if editorial test exists and user is in bucket A', () => { + it('returns the default headline if editorial test exists and user is in a test bucket, but page is not in allowed fronts list', () => { expect( - decideHeadline(cardWithEditorialTest, { - 'fronts-and-curation-editorial-headline-test': 'a', - }), + decideHeadline( + cardWithEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'a', + }, + 'invalid-test-front', + ), + ).toEqual('Headline'); + }); + + it('returns headline A if editorial test exists, page is in allowed fronts list, and user is in bucket A', () => { + expect( + decideHeadline( + cardWithEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'a', + }, + 'test-front', + ), ).toEqual('Headline A'); }); - it('returns headline B if editorial test exists and user is in bucket B', () => { + it('returns headline B if editorial test exists, page is in allowed fronts list, and user is in bucket B', () => { expect( - decideHeadline(cardWithEditorialTest, { - 'fronts-and-curation-editorial-headline-test': 'b', - }), + decideHeadline( + cardWithEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'b', + }, + 'test-front', + ), ).toEqual('Headline B'); }); }); diff --git a/dotcom-rendering/src/model/enhanceCards.ts b/dotcom-rendering/src/model/enhanceCards.ts index 0b3546380c1..9e3c7feb69b 100644 --- a/dotcom-rendering/src/model/enhanceCards.ts +++ b/dotcom-rendering/src/model/enhanceCards.ts @@ -210,28 +210,32 @@ const findActiveEditorialTest = ( export const decideHeadline = ( faciaCard: FEFrontCard, serverSideABTests: Record, + pageId?: string, ): string => { + const defaultHeadline = faciaCard.header.headline; + const activeEditorialTest = findActiveEditorialTest( faciaCard.properties.tests, ); - // return default headline if there is no editorial test on the card - if (!activeEditorialTest) { - return faciaCard.header.headline; - } + if (!activeEditorialTest) return defaultHeadline; + + const testCanRunOnPage = + pageId !== undefined && + activeEditorialTest.frontsThisTestCanRunOn.includes(pageId); + + if (!testCanRunOnPage) return defaultHeadline; const testBucket = - serverSideABTests?.['fronts-and-curation-editorial-headline-test']; - - // return a different variant headline for each test bucket, or return the default - // headline if not in a test bucket - if (testBucket === 'a') { - return String(activeEditorialTest.variantMeta[0]?.meta.headline); - } else if (testBucket === 'b') { - return String(activeEditorialTest.variantMeta[1]?.meta.headline); - } else { - return faciaCard.header.headline; - } + serverSideABTests['fronts-and-curation-editorial-headline-test']; + + const variantMeta = activeEditorialTest.variantMeta.find( + (variant) => variant.id.toLowerCase() === testBucket, + ); + + if (variantMeta === undefined) return defaultHeadline; + + return String(variantMeta.meta.headline); }; /** @@ -501,8 +505,7 @@ export const enhanceCards = ( format, dataLinkName, url: decideUrl(faciaCard), - // TODO - respect value of frontsThisTestCanRunOn - compare value of pageId - headline: decideHeadline(faciaCard, serverSideABTests), + headline: decideHeadline(faciaCard, serverSideABTests, pageId), trailText: faciaCard.card.trailText, starRating: faciaCard.card.starRating, webPublicationDate: !isUndefined( diff --git a/dotcom-rendering/src/model/enhanceCollections.ts b/dotcom-rendering/src/model/enhanceCollections.ts index 7efe9aaa2ca..8e711c06c4a 100644 --- a/dotcom-rendering/src/model/enhanceCollections.ts +++ b/dotcom-rendering/src/model/enhanceCollections.ts @@ -131,10 +131,12 @@ export const enhanceCollections = ({ discussionApiUrl, stripBrandingFromCards, serverSideABTests, + pageId, ), curated: enhanceCards(collection.curated, { cardInTagPage: false, editionId, + pageId, discussionApiUrl, stripBranding: stripBrandingFromCards, serverSideABTests, @@ -142,6 +144,7 @@ export const enhanceCollections = ({ backfill: enhanceCards(collection.backfill, { cardInTagPage: false, editionId, + pageId, discussionApiUrl, stripBranding: stripBrandingFromCards, serverSideABTests, diff --git a/dotcom-rendering/src/model/groupCards.ts b/dotcom-rendering/src/model/groupCards.ts index 332c95621a3..7c0b9f29067 100644 --- a/dotcom-rendering/src/model/groupCards.ts +++ b/dotcom-rendering/src/model/groupCards.ts @@ -26,6 +26,7 @@ export const groupCards = ( discussionApiUrl: string, stripBranding: boolean = false, serverSideABTests: Record, + pageId: string, ): DCRGroupedTrails => { switch (container) { case 'flexible/general': { @@ -43,6 +44,7 @@ export const groupCards = ( const enhanceOptions = (offset = 0) => ({ cardInTagPage: false, editionId, + pageId, discussionApiUrl, offset, stripBranding, @@ -66,6 +68,7 @@ export const groupCards = ( const enhanceOptions = (offset = 0) => ({ cardInTagPage: false, editionId, + pageId, discussionApiUrl, offset, stripBranding, From af7a051380f1d2c3fb3ea56d2c9ce224a24e14e3 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Wed, 19 Aug 2026 10:45:15 +0100 Subject: [PATCH 3/7] Explicitly check test bucket participation early on instead of handling implicitly later in the function --- dotcom-rendering/src/model/enhanceCards.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dotcom-rendering/src/model/enhanceCards.ts b/dotcom-rendering/src/model/enhanceCards.ts index 9e3c7feb69b..fdee4bee5a1 100644 --- a/dotcom-rendering/src/model/enhanceCards.ts +++ b/dotcom-rendering/src/model/enhanceCards.ts @@ -214,11 +214,16 @@ export const decideHeadline = ( ): string => { const defaultHeadline = faciaCard.header.headline; + const testBucket = + serverSideABTests['fronts-and-curation-editorial-headline-test']; + const activeEditorialTest = findActiveEditorialTest( faciaCard.properties.tests, ); - if (!activeEditorialTest) return defaultHeadline; + if (testBucket === undefined || !activeEditorialTest) { + return defaultHeadline; + } const testCanRunOnPage = pageId !== undefined && @@ -226,9 +231,6 @@ export const decideHeadline = ( if (!testCanRunOnPage) return defaultHeadline; - const testBucket = - serverSideABTests['fronts-and-curation-editorial-headline-test']; - const variantMeta = activeEditorialTest.variantMeta.find( (variant) => variant.id.toLowerCase() === testBucket, ); From 1ec5fda3bb71e839033ff12555b6cfb0e124a3c8 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Wed, 19 Aug 2026 11:18:34 +0100 Subject: [PATCH 4/7] Stronger type checking on variant headline --- dotcom-rendering/src/model/enhanceCards.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dotcom-rendering/src/model/enhanceCards.ts b/dotcom-rendering/src/model/enhanceCards.ts index fdee4bee5a1..5e5777ba73c 100644 --- a/dotcom-rendering/src/model/enhanceCards.ts +++ b/dotcom-rendering/src/model/enhanceCards.ts @@ -235,9 +235,10 @@ export const decideHeadline = ( (variant) => variant.id.toLowerCase() === testBucket, ); - if (variantMeta === undefined) return defaultHeadline; + // make sure the variant headline isn't undefined and that it is of type string + if (typeof variantMeta?.meta.headline !== 'string') return defaultHeadline; - return String(variantMeta.meta.headline); + return variantMeta.meta.headline; }; /** From bf3033d5233623783f3192b218c3df695f11cbd1 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Wed, 19 Aug 2026 15:59:35 +0100 Subject: [PATCH 5/7] Add more extensive tests --- .../src/model/enhanceCards.test.ts | 96 ++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/dotcom-rendering/src/model/enhanceCards.test.ts b/dotcom-rendering/src/model/enhanceCards.test.ts index 11f7c1f6fb9..3de556355b7 100644 --- a/dotcom-rendering/src/model/enhanceCards.test.ts +++ b/dotcom-rendering/src/model/enhanceCards.test.ts @@ -4,7 +4,7 @@ import type { FEMediaAtom, } from '../frontend/feFront'; import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat'; -import type { VariantMeta } from '../types/front'; +import type { EditorialTest, VariantMeta } from '../types/front'; import type { MainMedia } from '../types/mainMedia'; import { decideArticleMedia, @@ -610,6 +610,52 @@ describe('Enhance Cards', () => { }, }; + const cardWithEditorialTestWithUndefinedVariantMeta = { + ...cardWithEditorialTest, + properties: { + ...cardWithEditorialTest.properties, + tests: [ + { + ...cardWithEditorialTest.properties.tests[0], + variantMeta: [ + { + id: 'A', + meta: { + headline: undefined, + }, + } as VariantMeta, + ], + } as EditorialTest, + ], + }, + }; + + const cardWithExpiredEditorialTest = { + ...cardWithEditorialTest, + properties: { + ...cardWithEditorialTest.properties, + tests: [ + { + ...cardWithEditorialTest.properties.tests[0], + expiryDate: Date.now() - oneHourInMilliseconds, + } as EditorialTest, + ], + }, + }; + + const cardWithManuallyEndedEditorialTest = { + ...cardWithEditorialTest, + properties: { + ...cardWithEditorialTest.properties, + tests: [ + { + ...cardWithEditorialTest.properties.tests[0], + hasManuallyEndedOnThisTrail: true, + } as EditorialTest, + ], + }, + }; + it('returns the default headline if no editorial test exists on the card, page is not in allowed fronts list, and user is not in a test bucket', () => { expect( decideHeadline( @@ -673,5 +719,53 @@ describe('Enhance Cards', () => { ), ).toEqual('Headline B'); }); + + it('returns the default headline if the bucket name does not match a variant meta id', () => { + expect( + decideHeadline( + cardWithEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'c', + }, + 'test-front', + ), + ).toEqual('Headline'); + }); + + it('returns the default headline if the variant headline is undefined', () => { + expect( + decideHeadline( + cardWithEditorialTestWithUndefinedVariantMeta, + { + 'fronts-and-curation-editorial-headline-test': 'a', + }, + 'test-front', + ), + ).toEqual('Headline'); + }); + + it('returns the default headline if an editorial test has expired', () => { + expect( + decideHeadline( + cardWithExpiredEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'a', + }, + 'test-front', + ), + ).toEqual('Headline'); + }); + + it('returns the default headline if an editorial test has been manually ended', () => { + expect( + decideHeadline( + cardWithManuallyEndedEditorialTest, + { + 'fronts-and-curation-editorial-headline-test': 'a', + }, + 'test-front', + ), + ).toEqual('Headline'); + }); }); }); From dfe8a8f9aaff9e3c086242ff1a2e2f4ffaabd0c6 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Fri, 21 Aug 2026 11:58:01 +0100 Subject: [PATCH 6/7] Use isUndefined helper --- dotcom-rendering/src/model/enhanceCards.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotcom-rendering/src/model/enhanceCards.ts b/dotcom-rendering/src/model/enhanceCards.ts index 5e5777ba73c..0074d0cb647 100644 --- a/dotcom-rendering/src/model/enhanceCards.ts +++ b/dotcom-rendering/src/model/enhanceCards.ts @@ -221,12 +221,12 @@ export const decideHeadline = ( faciaCard.properties.tests, ); - if (testBucket === undefined || !activeEditorialTest) { + if (isUndefined(testBucket) || !activeEditorialTest) { return defaultHeadline; } const testCanRunOnPage = - pageId !== undefined && + !isUndefined(pageId) && activeEditorialTest.frontsThisTestCanRunOn.includes(pageId); if (!testCanRunOnPage) return defaultHeadline; From c3cde230fcbf750f0788d2523d1372f0fef6c5d4 Mon Sep 17 00:00:00 2001 From: Emma Imber Date: Fri, 21 Aug 2026 12:40:50 +0100 Subject: [PATCH 7/7] Drop tests from the return of the enhanceCards function --- dotcom-rendering/src/model/enhanceCards.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/dotcom-rendering/src/model/enhanceCards.ts b/dotcom-rendering/src/model/enhanceCards.ts index 0074d0cb647..86bdadba041 100644 --- a/dotcom-rendering/src/model/enhanceCards.ts +++ b/dotcom-rendering/src/model/enhanceCards.ts @@ -567,6 +567,5 @@ export const enhanceCards = ( ?.allImages[0]?.fields.altText ?? '', }, }), - tests: faciaCard.properties.tests, }; });