From 03931307596b0b33e9c9c31bee1cc8aef8134904 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 16 Mar 2026 12:55:43 +0000 Subject: [PATCH] Add "token without a username" test --- src/start-proxy.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/start-proxy.test.ts b/src/start-proxy.test.ts index d505d7868..3c806d056 100644 --- a/src/start-proxy.test.ts +++ b/src/start-proxy.test.ts @@ -496,6 +496,31 @@ test( }, ); +test( + "token without a username", + testPATWarning, + [ + { + type: "git_server", + host: "https://github.com/", + token: `ghp_${makeTestToken()}`, + }, + ], + (t, results) => { + // The configurations should be accepted, despite the likely problem. + t.assert(results); + t.is(results.length, 1); + t.is(results[0].type, "git_server"); + t.is(results[0].host, "https://github.com/"); + + if (startProxyExports.isToken(results[0])) { + t.assert(results[0].token?.startsWith("ghp_")); + } else { + t.fail("Expected a `Token`-based credential."); + } + }, +); + test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => { const credentialsInput = toEncodedJSON(mixedCredentials);