-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #2354 Credit: @nlf Close: #2354 Reviewed-by: @ruyadorno
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const { test } = require('tap') | ||
const requireInject = require('require-inject') | ||
|
||
let configArgs = null | ||
const npm = { | ||
commands: { | ||
config: (args, cb) => { | ||
configArgs = args | ||
return cb() | ||
}, | ||
}, | ||
} | ||
|
||
const set = requireInject('../../lib/set.js', { | ||
'../../lib/npm.js': npm, | ||
}) | ||
|
||
test('npm set - no args', t => { | ||
return set([], (err) => { | ||
t.match(err, /npm set/, 'prints usage') | ||
t.end() | ||
}) | ||
}) | ||
|
||
test('npm set', t => { | ||
return set(['email', 'me@me.me'], (err) => { | ||
if (err) | ||
throw err | ||
|
||
t.strictSame(configArgs, ['set', 'email', 'me@me.me'], 'passed the correct arguments to config') | ||
t.end() | ||
}) | ||
}) |