summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/ll.js
blob: 7d4e2b94f2b7e2d3f68556107cca3c17b0b22c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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.toString(), completion.toString())
t.test('the ll command', t => {
  ll([], () => {
    t.equal(lsCalled, true)
    t.strictSame(configs, { long: true })
    t.end()
  })
})