You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
881 B

'use strict'
var test = require('tap').test
var requireInject = require('require-inject')
var mockNpm = {
config: {
get: function (key) {
return false
}
},
commands: {
outdated: function (args, silent, cb) {
cb(null, [
[{path: '/incorrect', parent: {path: '/correct'}}, 'abc', '1.0.0', '1.1.0', '1.1.0', '^1.1.0']
])
}
}
}
// What we're testing here is that updates use the parent module's path to
// install from.
test('update', function (t) {
var update = requireInject('../../lib/update.js', {
'../../lib/npm.js': mockNpm,
'../../lib/install.js': {
'Installer': function (where, dryrun, args) {
t.is(where, '/correct', 'We should be installing to the parent of the modules being updated')
this.run = function (cb) { cb() }
}
}
})
update(['abc'], function () {
t.end()
})
})