@@ -167,13 +167,16 @@ describe('fetchGitHubContributions', () => {
167167 mockResponse ( {
168168 data : {
169169 user : {
170- contributionsCollection : { contributionCalendar : mockCalendar } ,
170+ contributionsCollection : {
171+ contributionCalendar : mockCalendar ,
172+ commitContributionsByRepository : [ ] ,
173+ } ,
171174 } ,
172175 } ,
173176 } )
174177 ) ;
175178
176- const result = await fetchGitHubContributions ( 'octocat' ) ;
179+ const { calendar : result } = await fetchGitHubContributions ( 'octocat' ) ;
177180
178181 expect ( result . totalContributions ) . toBe ( mockCalendar . totalContributions ) ;
179182 expect ( result . weeks [ 0 ] . contributionDays [ 0 ] . contributionCount ) . toBe ( 3 ) ;
@@ -184,7 +187,10 @@ describe('fetchGitHubContributions', () => {
184187 mockResponse ( {
185188 data : {
186189 user : {
187- contributionsCollection : { contributionCalendar : mockCalendar } ,
190+ contributionsCollection : {
191+ contributionCalendar : mockCalendar ,
192+ commitContributionsByRepository : [ ] ,
193+ } ,
188194 } ,
189195 } ,
190196 } )
@@ -214,7 +220,10 @@ describe('fetchGitHubContributions', () => {
214220 mockResponse ( {
215221 data : {
216222 user : {
217- contributionsCollection : { contributionCalendar : mockCalendar } ,
223+ contributionsCollection : {
224+ contributionCalendar : mockCalendar ,
225+ commitContributionsByRepository : [ ] ,
226+ } ,
218227 } ,
219228 } ,
220229 } )
@@ -254,7 +263,7 @@ describe('fetchGitHubContributions', () => {
254263 } )
255264 ) ;
256265
257- const result = await fetchGitHubContributions ( 'new-user' ) ;
266+ const { calendar : result } = await fetchGitHubContributions ( 'new-user' ) ;
258267
259268 expect ( result . totalContributions ) . toBe ( 0 ) ;
260269 expect ( result . weeks ) . toHaveLength ( 0 ) ;
@@ -393,7 +402,7 @@ describe('fetchGitHubContributions', () => {
393402 } )
394403 ) ;
395404
396- const result = await fetchGitHubContributions ( 'sparse-user' ) ;
405+ const { calendar : result } = await fetchGitHubContributions ( 'sparse-user' ) ;
397406 expect ( result . totalContributions ) . toBe ( 0 ) ;
398407 expect ( result . weeks ) . toHaveLength ( 1 ) ;
399408 } ) ;
@@ -420,8 +429,8 @@ describe('fetchGitHubContributions', () => {
420429 const r2 = await fetchGitHubContributions ( 'empty-user' , {
421430 bypassCache : true ,
422431 } ) ;
423- expect ( r1 . totalContributions ) . toBe ( r2 . totalContributions ) ;
424- expect ( r1 . weeks ) . toEqual ( r2 . weeks ) ;
432+ expect ( r1 . calendar . totalContributions ) . toBe ( r2 . calendar . totalContributions ) ;
433+ expect ( r1 . calendar . weeks ) . toEqual ( r2 . calendar . weeks ) ;
425434 } ) ;
426435} ) ;
427436
@@ -705,7 +714,19 @@ describe('getFullDashboardData', () => {
705714 return mockResponse ( {
706715 data : {
707716 user : {
708- contributionsCollection : { contributionCalendar : mockCalendar } ,
717+ contributionsCollection : {
718+ contributionCalendar : mockCalendar ,
719+ commitContributionsByRepository : [
720+ {
721+ repository : { primaryLanguage : { name : 'TypeScript' } } ,
722+ contributions : { totalCount : 200 } ,
723+ } ,
724+ {
725+ repository : { primaryLanguage : { name : 'Rust' } } ,
726+ contributions : { totalCount : 100 } ,
727+ } ,
728+ ] ,
729+ } ,
709730 } ,
710731 } ,
711732 } ) ;
@@ -784,7 +805,10 @@ describe('getFullDashboardData', () => {
784805 return mockResponse ( {
785806 data : {
786807 user : {
787- contributionsCollection : { contributionCalendar : mockCalendar } ,
808+ contributionsCollection : {
809+ contributionCalendar : mockCalendar ,
810+ commitContributionsByRepository : [ ] ,
811+ } ,
788812 } ,
789813 } ,
790814 } ) ;
@@ -813,7 +837,10 @@ describe('getFullDashboardData', () => {
813837 return mockResponse ( {
814838 data : {
815839 user : {
816- contributionsCollection : { contributionCalendar : mockCalendar } ,
840+ contributionsCollection : {
841+ contributionCalendar : mockCalendar ,
842+ commitContributionsByRepository : [ ] ,
843+ } ,
817844 } ,
818845 } ,
819846 } ) ;
@@ -883,7 +910,10 @@ describe('GitHub API cache behavior', () => {
883910 mockResponse ( {
884911 data : {
885912 user : {
886- contributionsCollection : { contributionCalendar : mockCalendar } ,
913+ contributionsCollection : {
914+ contributionCalendar : mockCalendar ,
915+ commitContributionsByRepository : [ ] ,
916+ } ,
887917 } ,
888918 } ,
889919 } )
@@ -916,14 +946,17 @@ describe('GitHub API cache behavior', () => {
916946 mockResponse ( {
917947 data : {
918948 user : {
919- contributionsCollection : { contributionCalendar : mockCalendar } ,
949+ contributionsCollection : {
950+ contributionCalendar : mockCalendar ,
951+ commitContributionsByRepository : [ ] ,
952+ } ,
920953 } ,
921954 } ,
922955 } )
923956 ) ;
924957
925958 const results = await requests ;
926- expect ( results . map ( ( result ) => result . totalContributions ) ) . toEqual ( [ 42 , 42 , 42 ] ) ;
959+ expect ( results . map ( ( result ) => result . calendar . totalContributions ) ) . toEqual ( [ 42 , 42 , 42 ] ) ;
927960 } ) ;
928961
929962 it ( 'dedupes rapid synchronous contribution requests until the delayed fetch resolves once' , async ( ) => {
@@ -967,15 +1000,18 @@ describe('GitHub API cache behavior', () => {
9671000 const results = await Promise . all ( requests ) ;
9681001
9691002 expect ( resolveFetchSpy ) . toHaveBeenCalledTimes ( 1 ) ;
970- expect ( results . map ( ( result ) => result . totalContributions ) ) . toEqual ( [ 42 , 42 , 42 ] ) ;
1003+ expect ( results . map ( ( result ) => result . calendar . totalContributions ) ) . toEqual ( [ 42 , 42 , 42 ] ) ;
9711004 } ) ;
9721005
9731006 it ( 'refresh bypass: bypassCache=true forces a fresh fetch' , async ( ) => {
9741007 vi . mocked ( fetch ) . mockImplementation ( async ( ) =>
9751008 mockResponse ( {
9761009 data : {
9771010 user : {
978- contributionsCollection : { contributionCalendar : mockCalendar } ,
1011+ contributionsCollection : {
1012+ contributionCalendar : mockCalendar ,
1013+ commitContributionsByRepository : [ ] ,
1014+ } ,
9791015 } ,
9801016 } ,
9811017 } )
@@ -995,7 +1031,10 @@ describe('GitHub API cache behavior', () => {
9951031 mockResponse ( {
9961032 data : {
9971033 user : {
998- contributionsCollection : { contributionCalendar : mockCalendar } ,
1034+ contributionsCollection : {
1035+ contributionCalendar : mockCalendar ,
1036+ commitContributionsByRepository : [ ] ,
1037+ } ,
9991038 } ,
10001039 } ,
10011040 } )
@@ -1372,7 +1411,10 @@ describe('getOrgDashboardData', () => {
13721411 return mockResponse ( {
13731412 data : {
13741413 user : {
1375- contributionsCollection : { contributionCalendar : mockCalendar } ,
1414+ contributionsCollection : {
1415+ contributionCalendar : mockCalendar ,
1416+ commitContributionsByRepository : [ ] ,
1417+ } ,
13761418 } ,
13771419 } ,
13781420 } ) ;
0 commit comments