@@ -252,6 +252,47 @@ test("getCredentials returns all for a language when specified", async (t) => {
252252 t . assert ( credentialsTypes . includes ( "git_source" ) ) ;
253253} ) ;
254254
255+ test ( "getCredentials returns all goproxy_servers for a language when specified" , async ( t ) => {
256+ const multipleGoproxyServers = [
257+ { type : "goproxy_server" , host : "goproxy1.example.com" , token : "token1" } ,
258+ { type : "goproxy_server" , host : "goproxy2.example.com" , token : "token2" } ,
259+ { type : "git_source" , host : "github.com/github" , token : "mno" } ,
260+ ] ;
261+
262+ const credentials = startProxyExports . getCredentials (
263+ getRunnerLogger ( true ) ,
264+ undefined ,
265+ toEncodedJSON ( multipleGoproxyServers ) ,
266+ KnownLanguage . go ,
267+ ) ;
268+ t . is ( credentials . length , 3 ) ;
269+
270+ const goproxyServers = credentials . filter ( ( c ) => c . type === "goproxy_server" ) ;
271+ t . is ( goproxyServers . length , 2 ) ;
272+ t . assert ( goproxyServers . some ( ( c ) => c . host === "goproxy1.example.com" ) ) ;
273+ t . assert ( goproxyServers . some ( ( c ) => c . host === "goproxy2.example.com" ) ) ;
274+ } ) ;
275+
276+ test ( "getCredentials returns all maven_repositories for a language when specified" , async ( t ) => {
277+ const multipleMavenRepositories = [
278+ { type : "maven_repository" , host : "maven1.pkg.github.com" , token : "token1" } ,
279+ { type : "maven_repository" , host : "maven2.pkg.github.com" , token : "token2" } ,
280+ { type : "git_source" , host : "github.com/github" , token : "mno" } ,
281+ ] ;
282+
283+ const credentials = startProxyExports . getCredentials (
284+ getRunnerLogger ( true ) ,
285+ undefined ,
286+ toEncodedJSON ( multipleMavenRepositories ) ,
287+ KnownLanguage . java ,
288+ ) ;
289+ t . is ( credentials . length , 2 ) ;
290+
291+ const mavenRepositories = credentials . filter ( ( c ) => c . type === "maven_repository" ) ;
292+ t . assert ( mavenRepositories . some ( ( c ) => c . host === "maven1.pkg.github.com" ) ) ;
293+ t . assert ( mavenRepositories . some ( ( c ) => c . host === "maven2.pkg.github.com" ) ) ;
294+ } ) ;
295+
255296test ( "getCredentials returns all credentials when no language specified" , async ( t ) => {
256297 const credentialsInput = toEncodedJSON ( mixedCredentials ) ;
257298
0 commit comments