mirror of https://github.com/nodejs/corepack.git
test: fix testing error
This commit is contained in:
parent
d29d55664f
commit
1435643a31
|
|
@ -20,6 +20,7 @@ describe(`npm registry utils fetchAsJson`, () => {
|
|||
});
|
||||
|
||||
it(`loads from DEFAULT_NPM_REGISTRY_URL by default`, async () => {
|
||||
process.env.npm_config_registry = `https://registry.npmjs.org`;
|
||||
await fetchAsJson(`package-name`);
|
||||
|
||||
expect(httpFetchAsJson).toBeCalled();
|
||||
|
|
@ -38,6 +39,7 @@ describe(`npm registry utils fetchAsJson`, () => {
|
|||
it(`adds authorization header with bearer token if COREPACK_NPM_TOKEN is set`, async () => {
|
||||
// `process.env` is reset after each tests in setupTests.js.
|
||||
process.env.COREPACK_NPM_TOKEN = `foo`;
|
||||
process.env.npm_config_registry = `https://registry.npmjs.org`;
|
||||
|
||||
await fetchAsJson(`package-name`);
|
||||
|
||||
|
|
@ -53,6 +55,7 @@ describe(`npm registry utils fetchAsJson`, () => {
|
|||
process.env.COREPACK_NPM_TOKEN = `foo`;
|
||||
process.env.COREPACK_NPM_USERNAME = `bar`;
|
||||
process.env.COREPACK_NPM_PASSWORD = `foobar`;
|
||||
process.env.npm_config_registry = `https://registry.npmjs.org`;
|
||||
|
||||
await fetchAsJson(`package-name`);
|
||||
|
||||
|
|
@ -68,6 +71,7 @@ describe(`npm registry utils fetchAsJson`, () => {
|
|||
// `process.env` is reset after each tests in setupTests.js.
|
||||
process.env.COREPACK_NPM_USERNAME = `foo`;
|
||||
process.env.COREPACK_NPM_PASSWORD = `bar`;
|
||||
process.env.npm_config_registry = `https://registry.npmjs.org`;
|
||||
|
||||
const encodedCreds = Buffer.from(`${process.env.COREPACK_NPM_USERNAME}:${process.env.COREPACK_NPM_PASSWORD}`, `utf8`).toString(`base64`);
|
||||
|
||||
|
|
@ -80,9 +84,10 @@ describe(`npm registry utils fetchAsJson`, () => {
|
|||
}});
|
||||
});
|
||||
|
||||
it(`does not add authorization header if COREPACK_NPM_USERNAME is set and COREPACK_NPM_PASSWORD is not.`, async () => {
|
||||
it(`does not add authorization header if COREPACK_NPM_USERNAME is set and COREPACK_NPM_PASSWORD is not`, async () => {
|
||||
// `process.env` is reset after each tests in setupTests.js.
|
||||
process.env.COREPACK_NPM_USERNAME = `foo`;
|
||||
process.env.npm_config_registry = `https://registry.npmjs.org`;
|
||||
|
||||
await fetchAsJson(`package-name`);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue