Skip to content

Commit

Permalink
tests: tests for prefix command
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Oct 5, 2020
1 parent d816c2e commit c8f0d54
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/lib/prefix.js
Original file line number Diff line number Diff line change
@@ -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')
})
})

0 comments on commit c8f0d54

Please sign in to comment.