File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -484,6 +484,38 @@ describe('GitHub API cache behavior', () => {
484484
485485 expect ( fetch ) . toHaveBeenCalledTimes ( 2 ) ;
486486 } ) ;
487+
488+ it ( 'handles a new account with no public repos correctly' , async ( ) => {
489+ vi . mocked ( fetch ) . mockImplementation ( async ( url : any ) => {
490+ if ( typeof url === 'string' && url . includes ( '/users/octocat/repos' ) ) {
491+ return mockResponse ( [ ] ) ;
492+ }
493+ if ( typeof url === 'string' && url . includes ( '/users/octocat' ) ) {
494+ return mockResponse ( {
495+ login : 'octocat' ,
496+ name : 'The Octocat' ,
497+ avatar_url : 'avatar.png' ,
498+ public_repos : 0 ,
499+ followers : 0 ,
500+ following : 0 ,
501+ created_at : '2024-01-01T00:00:00Z' ,
502+ bio : null ,
503+ location : null ,
504+ } ) ;
505+ }
506+ return mockResponse ( {
507+ data : {
508+ user : { contributionsCollection : { contributionCalendar : mockCalendar } } ,
509+ } ,
510+ } ) ;
511+ } ) ;
512+
513+ const result = await getFullDashboardData ( 'octocat' ) ;
514+
515+ expect ( result . languages ) . toEqual ( [ ] ) ;
516+ expect ( result . profile . stats . stars ) . toBe ( 0 ) ;
517+ expect ( result . profile . developerScore ) . toBeGreaterThanOrEqual ( 0 ) ;
518+ } ) ;
487519} ) ;
488520describe ( 'generateAchievements' , ( ) => {
489521 it ( 'marks contribution milestones correctly' , ( ) => {
You can’t perform that action at this time.
0 commit comments