diff options
author | dr-js <dr@dr.run> | 2021-01-08 04:43:30 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2021-01-28 23:30:15 +0300 |
commit | f1bea2f09e283f994bd8b69a356cbe11559c8c1f (patch) | |
tree | db22eafd08d3e0de428b7524bbe34a35eaf25d0d /test | |
parent | 8d3fd63aaa6a5c9b3d2281dd0bd9e1c270b35941 (diff) |
test: publish: test add read registry only from publishConfig
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/publish.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/lib/publish.js b/test/lib/publish.js index d4e41605d..675824848 100644 --- a/test/lib/publish.js +++ b/test/lib/publish.js @@ -369,3 +369,44 @@ t.test('throw if not logged in', async t => { }, 'throws when not logged in') }) }) + +t.test('read registry only from publishConfig', t => { + t.plan(3) + + const publishConfig = { registry: 'https://some.registry' } + const testDir = t.testdir({ + 'package.json': JSON.stringify({ + name: 'my-cool-pkg', + version: '1.0.0', + publishConfig, + }, null, 2), + }) + + const publish = requireInject('../../lib/publish.js', { + '../../lib/npm.js': { + flatOptions: { + json: false, + }, + config, + }, + '../../lib/utils/tar.js': { + getContents: () => ({ + id: 'someid', + }), + logTar: () => {}, + }, + '../../lib/utils/output.js': () => {}, + libnpmpublish: { + publish: (manifest, tarData, opts) => { + t.match(manifest, { name: 'my-cool-pkg', version: '1.0.0' }, 'gets manifest') + t.same(opts.registry, publishConfig.registry, 'publishConfig is passed through') + }, + }, + }) + + return publish([testDir], (er) => { + if (er) + throw er + t.pass('got to callback') + }) +}) |