diff options
author | nlf <quitlahok@gmail.com> | 2020-10-05 19:46:44 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2020-10-05 19:46:44 +0300 |
commit | c8f0d5457dd913b425987ae30a611d4eb9e84b7d (patch) | |
tree | 585cac8a05adf60ab5afe13a8eea82a7938ca642 /test | |
parent | d816c2efae41930cbdf4fff8657e0adc450d1dd4 (diff) |
tests: tests for prefix command
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/prefix.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lib/prefix.js b/test/lib/prefix.js new file mode 100644 index 000000000..a6e4d731a --- /dev/null +++ b/test/lib/prefix.js @@ -0,0 +1,19 @@ +const { test } = require('tap') +const requireInject = require('require-inject') + +test('prefix', (t) => { + t.plan(3) + const dir = '/prefix/dir' + + const prefix = requireInject('../../lib/prefix.js', { + '../../lib/npm.js': { prefix: dir }, + '../../lib/utils/output.js': (output) => { + t.equal(output, dir, 'prints the correct directory') + } + }) + + prefix([], (err) => { + t.ifError(err, 'npm prefix') + t.ok('should have printed directory') + }) +}) |