diff options
author | isaacs <i@izs.me> | 2020-07-16 04:43:16 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-07-29 21:53:10 +0300 |
commit | 4f8da6a38bd0fd09b6eab1ce6fcdfc14668b8c28 (patch) | |
tree | 8b462e540628a810f74dfb6eb4df3584d2581db7 /test/lib/ll.js | |
parent | ffafd2c5b5d406e6e5b569db4a7697ba31b3bf15 (diff) |
make ll a first-class command to make the cmd implementation easier
It was a mistake to have a command alias that sets a config.
Diffstat (limited to 'test/lib/ll.js')
-rw-r--r-- | test/lib/ll.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lib/ll.js b/test/lib/ll.js new file mode 100644 index 000000000..c08baa977 --- /dev/null +++ b/test/lib/ll.js @@ -0,0 +1,31 @@ +const t = require('tap') +const requireInject = require('require-inject') +const configs = {} +let lsCalled = false +const ll = requireInject('../../lib/ll.js', { + '../../lib/npm.js': { + config: { + set: (k, v) => { + configs[k] = v + } + }, + commands: { + ls: (args, cb) => { + lsCalled = true + cb() + } + } + } +}) + +const ls = require('../../lib/ls.js') +const { usage, completion } = ls +t.equal(ll.usage, usage) +t.equal(ll.completion, completion) +t.test('the ll command', t => { + ll([], () => { + t.equal(lsCalled, true) + t.strictSame(configs, { long: true }) + t.end() + }) +}) |