summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/birthday.js
blob: 0589be7a8eedbfe47d03af99cfb96a08db9eb2ad (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
const t = require('tap')
const mockNpm = require('../fixtures/mock-npm')

const config = {
  yes: false,
  package: [],
}
const npm = mockNpm({
  config,
  commands: {
    exec: (args, cb) => {
      t.equal(npm.config.get('yes'), true, 'should say yes')
      t.strictSame(npm.config.get('package'), ['@npmcli/npm-birthday'],
        'uses correct package')
      t.strictSame(args, ['npm-birthday'], 'called with correct args')
      t.match(cb, Function, 'callback is a function')
      cb()
    },
  },
})

const Birthday = require('../../lib/birthday.js')
const birthday = new Birthday(npm)

let calledCb = false
birthday.exec([], () => calledCb = true)
t.equal(calledCb, true, 'called the callback')