Skip to content

Commit d48086d

Browse files
committed
tests: tests for root command
1 parent c8f0d54 commit d48086d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/lib/root.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { test } = require('tap')
2+
const requireInject = require('require-inject')
3+
4+
test('root', (t) => {
5+
t.plan(3)
6+
const dir = '/root/dir'
7+
8+
const root = requireInject('../../lib/root.js', {
9+
'../../lib/npm.js': { dir },
10+
'../../lib/utils/output.js': (output) => {
11+
t.equal(output, dir, 'prints the correct directory')
12+
}
13+
})
14+
15+
root([], (err) => {
16+
t.ifError(err, 'npm root')
17+
t.ok('should have printed directory')
18+
})
19+
})

0 commit comments

Comments
 (0)