File tree Expand file tree Collapse file tree
app/(root)/dashboard/[username] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ vi.mock('@/components/dashboard/CommitClock', () => ({
4646} ) ) ;
4747
4848vi . mock ( '@/components/dashboard/Heatmap' , ( ) => ( {
49- default : ( ) => < div data-testid = "heatmap" > Heatmap</ div > ,
49+ default : ( { data } : { data : unknown [ ] } ) => (
50+ < div data-testid = "heatmap" data-prop = { JSON . stringify ( data ) } >
51+ Heatmap
52+ </ div >
53+ ) ,
5054} ) ) ;
5155
5256vi . mock ( '@/components/dashboard/AIInsights' , ( ) => ( {
@@ -137,4 +141,15 @@ describe('DashboardPage', () => {
137141 expect ( screen . getByText ( 'Contributions: 500' ) ) . toBeDefined ( ) ;
138142 } ) ;
139143 } ) ;
144+ it ( 'passes the correct activity data to Heatmap' , async ( ) => {
145+ const PageContent = await DashboardPage ( {
146+ params : Promise . resolve ( { username : 'octocat' } ) ,
147+ searchParams : Promise . resolve ( { } ) ,
148+ } ) ;
149+
150+ render ( PageContent ) ;
151+
152+ const heatmap = screen . getByTestId ( 'heatmap' ) ;
153+ expect ( JSON . parse ( heatmap . getAttribute ( 'data-prop' ) ?? '[]' ) ) . toEqual ( mockData . activity ) ;
154+ } ) ;
140155} ) ;
You can’t perform that action at this time.
0 commit comments