@@ -737,6 +737,37 @@ describe('GET /api/streak', () => {
737737 expect ( response . status ) . toBe ( 200 ) ;
738738 expect ( body ) . toContain ( 'CURRENT_STREAK' ) ;
739739 } ) ;
740+ // =========================================================================
741+ // ISSUE OBJECTIVE: Route test for ?view=monthly&delta_format=absolute
742+ // =========================================================================
743+ it ( 'applies delta_format=absolute to show raw commit counts in the monthly SVG' , async ( ) => {
744+ // 1. Mock the GitHub fetch with actual weekly data using vi.mocked
745+ vi . mocked ( fetchGitHubContributions ) . mockResolvedValueOnce ( {
746+ totalContributions : 150 ,
747+ weeks : [
748+ { contributionDays : [ { date : '2026-04-15' , contributionCount : 10 } ] } ,
749+ { contributionDays : [ { date : '2026-05-15' , contributionCount : 15 } ] } ,
750+ ] ,
751+ } as unknown as ContributionCalendar ) ;
752+
753+ // 2. Lock the system time to May 2026 so the calendar calculation aligns
754+ vi . useFakeTimers ( ) ;
755+ vi . setSystemTime ( new Date ( '2026-05-20T12:00:00Z' ) ) ;
756+
757+ // 3. Make request using the file's built-in makeRequest helper
758+ const req = makeRequest ( { user : 'octocat' , view : 'monthly' , delta_format : 'absolute' } ) ;
759+ const res = await GET ( req ) ;
760+
761+ expect ( res . status ) . toBe ( 200 ) ;
762+
763+ const body = await res . text ( ) ;
764+
765+ // 4. Assert body contains 'commits' (the absolute delta unit)
766+ expect ( body ) . toContain ( 'commits' ) ;
767+
768+ // Cleanup
769+ vi . useRealTimers ( ) ;
770+ } ) ;
740771 } ) ;
741772
742773 describe ( 'theme=random cache header' , ( ) => {
0 commit comments