File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22import { NextResponse } from 'next/server' ;
33import { fetchGitHubContributions } from '../../../lib/github' ;
44import { calculateStreak , calculateMonthlyStats } from '../../../lib/calculate' ;
5- import {
6- generateNotFoundSVG ,
7- generateSVG ,
8- generateMonthlySVG ,
9- escapeXML ,
10- } from '../../../lib/svg/generator' ;
5+ import { generateNotFoundSVG , generateSVG , generateMonthlySVG } from '../../../lib/svg/generator' ;
116import { getSecondsUntilUTCMidnight , getSecondsUntilMidnightInTimezone } from '../../../utils/time' ;
127import type { BadgeParams } from '../../../types' ;
138import { themes } from '../../../lib/svg/themes' ;
Original file line number Diff line number Diff line change @@ -511,6 +511,41 @@ describe('generateSVG', () => {
511511 expect ( svg ) . not . toContain ( 'fill="white" fill-opacity="0.2"' ) ;
512512 } ) ;
513513 } ) ;
514+
515+ describe ( 'SVG dimensions per size' , ( ) => {
516+ it ( 'renders width="600" and height="420" for medium size (default)' , ( ) => {
517+ const svg = generateSVG (
518+ mockStats ,
519+ { user : 'avi' , size : 'medium' } as unknown as BadgeParams ,
520+ mockCalendar
521+ ) ;
522+
523+ expect ( svg ) . toContain ( 'width="600"' ) ;
524+ expect ( svg ) . toContain ( 'height="420"' ) ;
525+ } ) ;
526+
527+ it ( 'renders width="400" and height="280" for small size' , ( ) => {
528+ const svg = generateSVG (
529+ mockStats ,
530+ { user : 'avi' , size : 'small' } as unknown as BadgeParams ,
531+ mockCalendar
532+ ) ;
533+
534+ expect ( svg ) . toContain ( 'width="400"' ) ;
535+ expect ( svg ) . toContain ( 'height="280"' ) ;
536+ } ) ;
537+
538+ it ( 'renders width="800" and height="560" for large size' , ( ) => {
539+ const svg = generateSVG (
540+ mockStats ,
541+ { user : 'avi' , size : 'large' } as unknown as BadgeParams ,
542+ mockCalendar
543+ ) ;
544+
545+ expect ( svg ) . toContain ( 'width="800"' ) ;
546+ expect ( svg ) . toContain ( 'height="560"' ) ;
547+ } ) ;
548+ } ) ;
514549} ) ;
515550
516551describe ( 'generateMonthlySVG' , ( ) => {
You can’t perform that action at this time.
0 commit comments