mirror of
https://github.com/github/codeql-action.git
synced 2026-01-05 06:00:32 +08:00
Check that proxy configurations are an array
This commit is contained in:
@@ -26,6 +26,26 @@ test("getCredentials prefers registriesCredentials over registrySecrets", async
|
||||
t.is(credentials[0].host, "npm.pkg.github.com");
|
||||
});
|
||||
|
||||
test("getCredentials throws an error when configurations are not an array", async (t) => {
|
||||
const registryCredentials = Buffer.from(
|
||||
JSON.stringify({ type: "npm_registry", token: "abc" }),
|
||||
).toString("base64");
|
||||
|
||||
t.throws(
|
||||
() =>
|
||||
startProxyExports.getCredentials(
|
||||
getRunnerLogger(true),
|
||||
undefined,
|
||||
registryCredentials,
|
||||
undefined,
|
||||
),
|
||||
{
|
||||
message:
|
||||
"Expected credentials data to be an array of configurations, but it is not.",
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("getCredentials throws error when credential missing host and url", async (t) => {
|
||||
const registryCredentials = Buffer.from(
|
||||
JSON.stringify([{ type: "npm_registry", token: "abc" }]),
|
||||
|
||||
Reference in New Issue
Block a user