@@ -88,6 +88,10 @@ vi.mock('./Heatmap', () => ({
8888 default : ( ) => < div data-testid = "heatmap" /> ,
8989} ) ) ;
9090
91+ vi . mock ( './HistoricalTrendView' , ( ) => ( {
92+ default : ( ) => < div data-testid = "historical-trend-view" /> ,
93+ } ) ) ;
94+
9195vi . mock ( './AIInsights' , ( ) => ( {
9296 default : ( ) => < div data-testid = "ai-insights" /> ,
9397} ) ) ;
@@ -190,24 +194,36 @@ const secondDataWithLowerStreak = {
190194 } ,
191195} ;
192196
197+ const mockPeriod = {
198+ kind : 'year' as const ,
199+ label : '2026' ,
200+ from : '2026-01-01T00:00:00.000Z' ,
201+ to : '2026-12-31T23:59:59.999Z' ,
202+ year : '2026' ,
203+ } ;
204+
193205describe ( 'DashboardClient' , ( ) => {
194206 beforeEach ( ( ) => {
195207 vi . restoreAllMocks ( ) ;
196208 } ) ;
197209
198210 it ( 'renders standard single profile view by default' , ( ) => {
199- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
211+ render (
212+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
213+ ) ;
200214
201215 expect ( screen . getByText ( 'Shivangi' ) ) . toBeDefined ( ) ;
202216 expect ( screen . getByTestId ( 'profile-card' ) ) . toBeDefined ( ) ;
203217 expect ( screen . getByTestId ( 'achievements' ) ) . toBeDefined ( ) ;
204218 expect ( screen . getByTestId ( 'activity-landscape' ) ) . toBeDefined ( ) ;
205219 expect ( screen . getByTestId ( 'language-chart' ) ) . toBeDefined ( ) ;
206- expect ( screen . getByTestId ( 'heatmap ' ) ) . toBeDefined ( ) ;
220+ expect ( screen . getByTestId ( 'historical-trend-view ' ) ) . toBeDefined ( ) ;
207221 } ) ;
208222
209223 it ( 'opens and closes the compare profile modal' , async ( ) => {
210- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
224+ render (
225+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
226+ ) ;
211227
212228 const compareBtn = screen . getByText ( 'Compare Profile' ) ;
213229 expect ( compareBtn ) . toBeDefined ( ) ;
@@ -232,7 +248,9 @@ describe('DashboardClient', () => {
232248 ) ;
233249 vi . stubGlobal ( 'fetch' , mockFetch ) ;
234250
235- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
251+ render (
252+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
253+ ) ;
236254
237255 const compareBtn = screen . getByText ( 'Compare Profile' ) ;
238256 fireEvent . click ( compareBtn ) ;
@@ -265,7 +283,9 @@ describe('DashboardClient', () => {
265283 ) ;
266284 vi . stubGlobal ( 'fetch' , mockFetch ) ;
267285
268- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
286+ render (
287+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
288+ ) ;
269289
270290 // 1. Enter compare mode
271291 const compareBtn = screen . getByText ( 'Compare Profile' ) ;
@@ -300,7 +320,9 @@ describe('DashboardClient', () => {
300320 } ) ;
301321
302322 it ( 'generate your own button points to root /' , ( ) => {
303- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
323+ render (
324+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
325+ ) ;
304326
305327 const generateLink = screen . getByRole ( 'link' , { name : / g e n e r a t e y o u r o w n / i } ) ;
306328 expect ( generateLink . getAttribute ( 'href' ) ) . toBe ( '/' ) ;
@@ -309,7 +331,9 @@ describe('DashboardClient', () => {
309331 // ISSUE OBJECTIVE: Verify error is shown when comparing with same username
310332 // =========================================================================
311333 it ( 'shows an error when comparing with the same username (case-insensitive)' , async ( ) => {
312- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
334+ render (
335+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
336+ ) ;
313337
314338 // 1. Open modal
315339 const compareBtn = screen . getByText ( 'Compare Profile' ) ;
@@ -334,7 +358,9 @@ describe('DashboardClient', () => {
334358 // ISSUE OBJECTIVE #1063: Verify compare modal input can be cleared
335359 // =========================================================================
336360 it ( 'verify compare modal input can be cleared' , async ( ) => {
337- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
361+ render (
362+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
363+ ) ;
338364
339365 // 1. Open modal
340366 const compareBtn = screen . getByText ( 'Compare Profile' ) ;
@@ -366,7 +392,9 @@ describe('DashboardClient', () => {
366392
367393 vi . stubGlobal ( 'fetch' , mockFetch ) ;
368394
369- render ( < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" /> ) ;
395+ render (
396+ < DashboardClient initialData = { mockInitialData } username = "Shivangi1515" period = { mockPeriod } />
397+ ) ;
370398
371399 fireEvent . click ( screen . getByText ( 'Compare Profile' ) ) ;
372400
@@ -394,7 +422,13 @@ it('shows Most Consistent badge for profile with higher peak streak in compare m
394422
395423 vi . stubGlobal ( 'fetch' , mockFetch ) ;
396424
397- render ( < DashboardClient initialData = { initialDataWithHigherStreak } username = "Shivangi1515" /> ) ;
425+ render (
426+ < DashboardClient
427+ initialData = { initialDataWithHigherStreak }
428+ username = "Shivangi1515"
429+ period = { mockPeriod }
430+ />
431+ ) ;
398432
399433 fireEvent . click ( screen . getByText ( 'Compare Profile' ) ) ;
400434
0 commit comments