Welcome to mirror list, hosted at ThFree Co, Russian Federation.

set.js « lib « test « npm « deps - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f51065a4b293dbe9bd7dc58d1751fd9571e4af4d (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')

let configArgs = null
const npm = {
  commands: {
    config: (args, cb) => {
      configArgs = args
      cb()
    },
  },
}

const Set = t.mock('../../lib/set.js')
const set = new Set(npm)

t.test('npm set - no args', t => {
  set.exec([], (err) => {
    t.match(err, /npm set/, 'prints usage')
    t.end()
  })
})

t.test('npm set', t => {
  set.exec(['email', 'me@me.me'], (err) => {
    if (err)
      throw err

    t.strictSame(configArgs, ['set', 'email', 'me@me.me'], 'passed the correct arguments to config')
    t.end()
  })
})