Skip to content

Commit 0393130

Browse files
committed
Add "token without a username" test
1 parent f86097d commit 0393130

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/start-proxy.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,31 @@ test(
496496
},
497497
);
498498

499+
test(
500+
"token without a username",
501+
testPATWarning,
502+
[
503+
{
504+
type: "git_server",
505+
host: "https://github.com/",
506+
token: `ghp_${makeTestToken()}`,
507+
},
508+
],
509+
(t, results) => {
510+
// The configurations should be accepted, despite the likely problem.
511+
t.assert(results);
512+
t.is(results.length, 1);
513+
t.is(results[0].type, "git_server");
514+
t.is(results[0].host, "https://github.com/");
515+
516+
if (startProxyExports.isToken(results[0])) {
517+
t.assert(results[0].token?.startsWith("ghp_"));
518+
} else {
519+
t.fail("Expected a `Token`-based credential.");
520+
}
521+
},
522+
);
523+
499524
test("getCredentials returns all credentials for Actions when using LANGUAGE_TO_REGISTRY_TYPE", async (t) => {
500525
const credentialsInput = toEncodedJSON(mixedCredentials);
501526

0 commit comments

Comments
 (0)