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