• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var test = require('tap').test
3var requireInject = require('require-inject')
4
5var mockNpm = {
6  config: {
7    get: function (key) {
8      return false
9    }
10  },
11  commands: {
12    outdated: function (args, silent, cb) {
13      cb(null, [
14        [{path: '/incorrect', parent: {path: '/correct'}}, 'abc', '1.0.0', '1.1.0', '1.1.0', '^1.1.0']
15      ])
16    }
17  }
18}
19
20// What we're testing here is that updates use the parent module's path to
21// install from.
22test('update', function (t) {
23  var update = requireInject('../../lib/update.js', {
24    '../../lib/npm.js': mockNpm,
25    '../../lib/install.js': {
26      'Installer': function (where, dryrun, args) {
27        t.is(where, '/correct', 'We should be installing to the parent of the modules being updated')
28        this.run = function (cb) { cb() }
29      }
30    }
31  })
32  update(['abc'], function () {
33    t.end()
34  })
35})
36