@@ -252,6 +252,57 @@ 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 Go 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 Java when specified" , async ( t ) => {
277+ const multipleMavenRepositories = [
278+ {
279+ type : "maven_repository" ,
280+ host : "maven1.pkg.github.com" ,
281+ token : "token1" ,
282+ } ,
283+ {
284+ type : "maven_repository" ,
285+ host : "maven2.pkg.github.com" ,
286+ token : "token2" ,
287+ } ,
288+ { type : "git_source" , host : "github.com/github" , token : "mno" } ,
289+ ] ;
290+
291+ const credentials = startProxyExports . getCredentials (
292+ getRunnerLogger ( true ) ,
293+ undefined ,
294+ toEncodedJSON ( multipleMavenRepositories ) ,
295+ KnownLanguage . java ,
296+ ) ;
297+ t . is ( credentials . length , 2 ) ;
298+
299+ const mavenRepositories = credentials . filter (
300+ ( c ) => c . type === "maven_repository" ,
301+ ) ;
302+ t . assert ( mavenRepositories . some ( ( c ) => c . host === "maven1.pkg.github.com" ) ) ;
303+ t . assert ( mavenRepositories . some ( ( c ) => c . host === "maven2.pkg.github.com" ) ) ;
304+ } ) ;
305+
255306test ( "getCredentials returns all credentials when no language specified" , async ( t ) => {
256307 const credentialsInput = toEncodedJSON ( mixedCredentials ) ;
257308
0 commit comments