| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,3 +159,28 @@ test("getCredentials throws an error when non-printable characters are used", as | |||
| 159 | 159 | ); | |
| 160 | 160 | } | |
| 161 | 161 | }); | |
| 162 | + | ||
| 163 | + test("getCredentials corrects for the backend returning tokens as passwords", async (t) => { | ||
| 164 | + const tokenCredentials = [ | ||
| 165 | + { | ||
| 166 | + type: "npm_registry", | ||
| 167 | + host: "npm.pkg.github.com", | ||
| 168 | + password: "abc", | ||
| 169 | + }, | ||
| 170 | + { type: "maven_repository", host: "maven.pkg.github.com", token: "def" }, | ||
| 171 | + { type: "nuget_feed", host: "nuget.pkg.github.com", password: "ghi" }, | ||
| 172 | + { type: "goproxy_server", host: "goproxy.example.com", token: "jkl" }, | ||
| 173 | + ]; | ||
| 174 | + const credentialsInput = toEncodedJSON(tokenCredentials); | ||
| 175 | + | ||
| 176 | + const credentials = startProxyExports.getCredentials( | ||
| 177 | + getRunnerLogger(true), | ||
| 178 | + undefined, | ||
| 179 | + credentialsInput, | ||
| 180 | + undefined, | ||
| 181 | + ); | ||
| 182 | + for (const credential of credentials) { | ||
| 183 | + t.not(credential.token, undefined); | ||
| 184 | + t.is(credential.password, undefined); | ||
| 185 | + } | ||
| 186 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments