@@ -2,6 +2,7 @@ import type {
22 FEFrontCardStyle ,
33 FEMediaAsset ,
44 FEMediaAtom ,
5+ FESupportingContent ,
56} from '../frontend/feFront' ;
67import { ArticleDesign , ArticleDisplay , Pillar } from '../lib/articleFormat' ;
78import type { EditorialTest , VariantMeta } from '../types/front' ;
@@ -656,6 +657,16 @@ describe('Enhance Cards', () => {
656657 } ,
657658 } ;
658659
660+ const cardWithSublinkWithEditorialTest = {
661+ ...cardWithNoEditorialTest ,
662+ supportingContent : [ cardWithEditorialTest ] ,
663+ } ;
664+
665+ const cardWithSublinkWithExpiredEditorialTest = {
666+ ...cardWithNoEditorialTest ,
667+ supportingContent : [ cardWithExpiredEditorialTest ] ,
668+ } ;
669+
659670 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' , ( ) => {
660671 expect (
661672 decideHeadline (
@@ -789,5 +800,33 @@ describe('Enhance Cards', () => {
789800 ) ,
790801 ) . toEqual ( 'Headline' ) ;
791802 } ) ;
803+
804+ it ( 'returns the variant headline if an editorial test is present on a sublink' , ( ) => {
805+ expect (
806+ decideHeadline (
807+ cardWithSublinkWithEditorialTest
808+ . supportingContent [ 0 ] as FESupportingContent ,
809+ {
810+ 'fronts-and-curation-editorial-test' : 'a' ,
811+ } ,
812+ true ,
813+ 'test-front' ,
814+ ) ,
815+ ) . toEqual ( 'Headline A' ) ;
816+ } ) ;
817+
818+ it ( 'returns the default headline for a sublink if an editorial test is expired on a sublink' , ( ) => {
819+ expect (
820+ decideHeadline (
821+ cardWithSublinkWithExpiredEditorialTest
822+ . supportingContent [ 0 ] as FESupportingContent ,
823+ {
824+ 'fronts-and-curation-editorial-test' : 'a' ,
825+ } ,
826+ true ,
827+ 'test-front' ,
828+ ) ,
829+ ) . toEqual ( 'Headline' ) ;
830+ } ) ;
792831 } ) ;
793832} ) ;
0 commit comments