fix(landing): restore homepage view tracking (#6260)

This commit is contained in:
Theodore Li
2026-08-04 12:45:01 -07:00
committed by GitHub
parent c14818b7bb
commit a19ae165e0
2 changed files with 38 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
/**
* @vitest-environment node
*/
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
vi.mock('@sim/emcn', () => ({
cn: (...values: Array<string | false | null | undefined>) => values.filter(Boolean).join(' '),
}))
vi.mock('@/app/(landing)/components', () => ({
Cta: () => null,
Features: () => null,
Hero: () => null,
HomeStructuredData: () => null,
Mothership: () => null,
ProductDemo: () => null,
}))
vi.mock('@/app/(landing)/components/landing-layout', () => ({
LANDING_SECTION_RHYTHM: 'gap-test',
}))
vi.mock('@/app/(landing)/landing-analytics', () => ({
LandingAnalytics: () => <span>landing-analytics-marker</span>,
}))
import Landing from '@/app/(landing)/landing'
describe('Landing', () => {
it('mounts the landing page analytics tracker exactly once', () => {
const markup = renderToStaticMarkup(<Landing />)
expect(markup.match(/landing-analytics-marker/g)).toHaveLength(1)
})
})
+2
View File
@@ -8,6 +8,7 @@ import {
ProductDemo,
} from '@/app/(landing)/components'
import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layout'
import { LandingAnalytics } from '@/app/(landing)/landing-analytics'
/**
* Landing page root - owns the section order and the `<main>` content region.
@@ -26,6 +27,7 @@ import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layou
export default function Landing() {
return (
<main id='main-content' className={cn('flex flex-col', LANDING_SECTION_RHYTHM)}>
<LandingAnalytics />
<HomeStructuredData />
<Hero />
<ProductDemo />