Skip to content

Commit e114998

Browse files
committed
Add test for missing type
1 parent bd36637 commit e114998

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/start-proxy.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,27 @@ test("getCredentials throws error when credential is not an object", async (t) =
175175
}
176176
});
177177

178+
test("getCredentials throws error when credential is missing type", async (t) => {
179+
const testCredentials = [[{ token: "abc", url: "https://localhost" }]].map(
180+
toEncodedJSON,
181+
);
182+
183+
for (const testCredential of testCredentials) {
184+
t.throws(
185+
() =>
186+
startProxyExports.getCredentials(
187+
getRunnerLogger(true),
188+
undefined,
189+
testCredential,
190+
undefined,
191+
),
192+
{
193+
message: "Invalid credentials - must have a type",
194+
},
195+
);
196+
}
197+
});
198+
178199
test("getCredentials throws error when credential missing host and url", async (t) => {
179200
const testCredentials = [
180201
[{ type: "npm_registry", token: "abc" }],

0 commit comments

Comments
 (0)