File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1048,6 +1048,41 @@ describe('generateMonthlySVG', () => {
10481048
10491049 expect ( svg ) . toContain ( 'COMMITS THIS MONTH' ) ;
10501050 } ) ;
1051+
1052+ it ( 'renders monthly stats correctly with null deltaPercentage for delta_format percent' , ( ) => {
1053+ const nullDeltaStats : MonthlyStats = {
1054+ currentMonthTotal : 15 ,
1055+ previousMonthTotal : 0 ,
1056+ deltaPercentage : null ,
1057+ deltaAbsolute : 15 ,
1058+ currentMonthName : 'June' ,
1059+ } ;
1060+
1061+ const svg = generateMonthlySVG ( nullDeltaStats , {
1062+ user : 'octocat' ,
1063+ delta_format : 'percent' ,
1064+ } as unknown as BadgeParams ) ;
1065+
1066+ expect ( svg ) . toContain ( 'N/A' ) ;
1067+ expect ( svg ) . not . toContain ( '%' ) ;
1068+ } ) ;
1069+
1070+ it ( 'renders monthly stats correctly with null deltaPercentage for delta_format both' , ( ) => {
1071+ const nullDeltaStats : MonthlyStats = {
1072+ currentMonthTotal : 15 ,
1073+ previousMonthTotal : 0 ,
1074+ deltaPercentage : null ,
1075+ deltaAbsolute : 15 ,
1076+ currentMonthName : 'June' ,
1077+ } ;
1078+
1079+ const svg = generateMonthlySVG ( nullDeltaStats , {
1080+ user : 'octocat' ,
1081+ delta_format : 'both' ,
1082+ } as unknown as BadgeParams ) ;
1083+
1084+ expect ( svg ) . toContain ( 'N/A (+15)' ) ;
1085+ } ) ;
10511086} ) ;
10521087
10531088describe ( 'shading and gradients' , ( ) => {
You can’t perform that action at this time.
0 commit comments