File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * @vitest -environment node
3+ */
4+ import { renderToStaticMarkup } from 'react-dom/server'
5+ import { describe , expect , it , vi } from 'vitest'
6+
7+ vi . mock ( '@sim/emcn' , ( ) => ( {
8+ cn : ( ...values : Array < string | false | null | undefined > ) => values . filter ( Boolean ) . join ( ' ' ) ,
9+ } ) )
10+
11+ vi . mock ( '@/app/(landing)/components' , ( ) => ( {
12+ Cta : ( ) => null ,
13+ Features : ( ) => null ,
14+ Hero : ( ) => null ,
15+ HomeStructuredData : ( ) => null ,
16+ Mothership : ( ) => null ,
17+ ProductDemo : ( ) => null ,
18+ } ) )
19+
20+ vi . mock ( '@/app/(landing)/components/landing-layout' , ( ) => ( {
21+ LANDING_SECTION_RHYTHM : 'gap-test' ,
22+ } ) )
23+
24+ vi . mock ( '@/app/(landing)/landing-analytics' , ( ) => ( {
25+ LandingAnalytics : ( ) => < span > landing-analytics-marker</ span > ,
26+ } ) )
27+
28+ import Landing from '@/app/(landing)/landing'
29+
30+ describe ( 'Landing' , ( ) => {
31+ it ( 'mounts the landing page analytics tracker exactly once' , ( ) => {
32+ const markup = renderToStaticMarkup ( < Landing /> )
33+
34+ expect ( markup . match ( / l a n d i n g - a n a l y t i c s - m a r k e r / g) ) . toHaveLength ( 1 )
35+ } )
36+ } )
Original file line number Diff line number Diff line change 88 ProductDemo ,
99} from '@/app/(landing)/components'
1010import { LANDING_SECTION_RHYTHM } from '@/app/(landing)/components/landing-layout'
11+ import { LandingAnalytics } from '@/app/(landing)/landing-analytics'
1112
1213/**
1314 * 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
2627export default function Landing ( ) {
2728 return (
2829 < main id = 'main-content' className = { cn ( 'flex flex-col' , LANDING_SECTION_RHYTHM ) } >
30+ < LandingAnalytics />
2931 < HomeStructuredData />
3032 < Hero />
3133 < ProductDemo />
You can’t perform that action at this time.
0 commit comments