@@ -28,8 +28,10 @@ vi.mock('@/lib/content/seo', () => ({
2828} ) )
2929vi . mock ( '@/app/(landing)/components/json-ld/json-ld' , ( ) => ( { JsonLd : ( ) => null } ) )
3030vi . mock ( '@/app/(landing)/customers/components/customer-story-card/customer-story-card' , ( ) => ( {
31- CustomerStoryCard : ( { story } : { story : CustomerStory } ) => (
32- < a href = { `/customers/${ story . slug } ` } > { story . company } </ a >
31+ CustomerStoryCard : ( { story, priority } : { story : CustomerStory ; priority ?: boolean } ) => (
32+ < a href = { `/customers/${ story . slug } ` } data-priority = { priority } >
33+ { story . company }
34+ </ a >
3335 ) ,
3436} ) )
3537vi . mock ( '@/app/(landing)/customers/components/customer-story-page/customer-story-page' , ( ) => ( {
@@ -78,11 +80,21 @@ function setStories(rivianDraft: boolean, expDraft: boolean) {
7880beforeEach ( ( ) => vi . clearAllMocks ( ) )
7981
8082describe ( 'customer publication boundaries' , ( ) => {
83+ it ( 'prioritizes only the first rendered card when an earlier story has no content' , async ( ) => {
84+ setStories ( false , false )
85+ const exp = post ( 'exp-realty' , false )
86+ getBySlug . mockImplementation ( async ( slug : string ) => ( slug === exp . slug ? exp : null ) )
87+ const html = renderToStaticMarkup ( await CustomersPage ( ) )
88+ expect ( html ) . not . toContain ( 'href="/customers/rivian"' )
89+ expect ( html ) . toContain ( 'href="/customers/exp-realty" data-priority="true"' )
90+ } )
91+
8192 it ( 'preserves the complete noindex design preview when every story is a draft' , async ( ) => {
8293 setStories ( true , true )
8394 const html = renderToStaticMarkup ( await CustomersPage ( ) )
8495 expect ( html ) . toContain ( 'href="/customers/rivian"' )
8596 expect ( html ) . toContain ( 'href="/customers/exp-realty"' )
97+ expect ( html . match ( / d a t a - p r i o r i t y = " t r u e " / g) ) . toHaveLength ( 1 )
8698 expect ( ( await generateMetadata ( ) ) . robots ) . toEqual ( { index : false , follow : false } )
8799 } )
88100
0 commit comments