From f8aff3ad8b16231621e98d70f4f7440873175658 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Thu, 2 Apr 2026 10:58:47 -0500 Subject: [PATCH 1/4] Add tests for getCredentials with multiple goproxy_servers and maven_repositories --- src/start-proxy.test.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index 7643e6264a..36dfcbc5f2 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -252,6 +252,47 @@ test("getCredentials returns all for a language when specified", async (t) => { t.assert(credentialsTypes.includes("git_source")); }); +test("getCredentials returns all goproxy_servers for a language when specified", async (t) => { + const multipleGoproxyServers = [ + { type: "goproxy_server", host: "goproxy1.example.com", token: "token1" }, + { type: "goproxy_server", host: "goproxy2.example.com", token: "token2" }, + { type: "git_source", host: "github.com/github", token: "mno" }, + ]; + + const credentials = startProxyExports.getCredentials( + getRunnerLogger(true), + undefined, + toEncodedJSON(multipleGoproxyServers), + KnownLanguage.go, + ); + t.is(credentials.length, 3); + + const goproxyServers = credentials.filter((c) => c.type === "goproxy_server"); + t.is(goproxyServers.length, 2); + t.assert(goproxyServers.some((c) => c.host === "goproxy1.example.com")); + t.assert(goproxyServers.some((c) => c.host === "goproxy2.example.com")); +}); + +test("getCredentials returns all maven_repositories for a language when specified", async (t) => { + const multipleMavenRepositories = [ + { type: "maven_repository", host: "maven1.pkg.github.com", token: "token1" }, + { type: "maven_repository", host: "maven2.pkg.github.com", token: "token2" }, + { type: "git_source", host: "github.com/github", token: "mno" }, + ]; + + const credentials = startProxyExports.getCredentials( + getRunnerLogger(true), + undefined, + toEncodedJSON(multipleMavenRepositories), + KnownLanguage.java, + ); + t.is(credentials.length, 2); + + const mavenRepositories = credentials.filter((c) => c.type === "maven_repository"); + t.assert(mavenRepositories.some((c) => c.host === "maven1.pkg.github.com")); + t.assert(mavenRepositories.some((c) => c.host === "maven2.pkg.github.com")); +}); + test("getCredentials returns all credentials when no language specified", async (t) => { const credentialsInput = toEncodedJSON(mixedCredentials); From 43d8864b351ef0c7cbaeaed59d1d842831a32668 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Thu, 2 Apr 2026 11:38:03 -0500 Subject: [PATCH 2/4] Run `npm run lint-fix` to format the code --- src/start-proxy.test.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index 36dfcbc5f2..74943daf01 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -275,8 +275,16 @@ test("getCredentials returns all goproxy_servers for a language when specified", test("getCredentials returns all maven_repositories for a language when specified", async (t) => { const multipleMavenRepositories = [ - { type: "maven_repository", host: "maven1.pkg.github.com", token: "token1" }, - { type: "maven_repository", host: "maven2.pkg.github.com", token: "token2" }, + { + type: "maven_repository", + host: "maven1.pkg.github.com", + token: "token1", + }, + { + type: "maven_repository", + host: "maven2.pkg.github.com", + token: "token2", + }, { type: "git_source", host: "github.com/github", token: "mno" }, ]; @@ -288,7 +296,9 @@ test("getCredentials returns all maven_repositories for a language when specifie ); t.is(credentials.length, 2); - const mavenRepositories = credentials.filter((c) => c.type === "maven_repository"); + const mavenRepositories = credentials.filter( + (c) => c.type === "maven_repository", + ); t.assert(mavenRepositories.some((c) => c.host === "maven1.pkg.github.com")); t.assert(mavenRepositories.some((c) => c.host === "maven2.pkg.github.com")); }); From 14ed573199ffc1a27bd6116218d59ef752849231 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Tue, 7 Apr 2026 09:00:19 -0500 Subject: [PATCH 3/4] Specify "Go" for a test case Co-authored-by: Michael B. Gale --- src/start-proxy.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index 74943daf01..3fb8796f82 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -252,7 +252,7 @@ test("getCredentials returns all for a language when specified", async (t) => { t.assert(credentialsTypes.includes("git_source")); }); -test("getCredentials returns all goproxy_servers for a language when specified", async (t) => { +test("getCredentials returns all goproxy_servers for Go when specified", async (t) => { const multipleGoproxyServers = [ { type: "goproxy_server", host: "goproxy1.example.com", token: "token1" }, { type: "goproxy_server", host: "goproxy2.example.com", token: "token2" }, From 35a38985d3da54e70155a0ddbf77ff67f8df6859 Mon Sep 17 00:00:00 2001 From: Mario Campos Date: Tue, 7 Apr 2026 09:00:40 -0500 Subject: [PATCH 4/4] Specify "Java" for a test case Co-authored-by: Michael B. Gale --- src/start-proxy.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index 3fb8796f82..5e5bce6c93 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -273,7 +273,7 @@ test("getCredentials returns all goproxy_servers for Go when specified", async ( t.assert(goproxyServers.some((c) => c.host === "goproxy2.example.com")); }); -test("getCredentials returns all maven_repositories for a language when specified", async (t) => { +test("getCredentials returns all maven_repositories for Java when specified", async (t) => { const multipleMavenRepositories = [ { type: "maven_repository",