File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,6 +128,26 @@ describe("fetchLanguageData", () => {
128128 const result = await fetchLanguageData ( ) ;
129129 expect ( result ) . toEqual ( { Python : 500 } ) ;
130130 } ) ;
131+
132+ it ( "fetches from organizations" , async ( ) => {
133+ vi . unstubAllEnvs ( ) ;
134+ vi . stubEnv ( 'GITHUB_ORGS' , 'test-org' ) ;
135+
136+ const orgRepos = [
137+ { name : "org-repo" , fork : false , full_name : "test-org/org-repo" }
138+ ] ;
139+
140+ global . fetch
141+ . mockResolvedValueOnce ( { ok : true , json : async ( ) => orgRepos } )
142+ . mockResolvedValueOnce ( { ok : true , json : async ( ) => ( { TypeScript : 4000 } ) } )
143+
144+ const result = await fetchLanguageData ( ) ;
145+
146+ expect ( global . fetch ) . toHaveBeenCalledWith (
147+ 'https://api.github.com/orgs/test-org/repos?per_page=100'
148+ ) ;
149+ expect ( result ) . toEqual ( { TypeScript : 4000 } ) ;
150+ } ) ;
131151} ) ;
132152
133153describe ( "processLanguageData" , ( ) => {
You can’t perform that action at this time.
0 commit comments