0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-17 23:45:29 -05:00

fix logs and tests for #56

This commit is contained in:
Alex Kocharin 2014-03-13 19:23:21 +00:00
parent d657e180d5
commit df49fb84c1
6 changed files with 19 additions and 10 deletions

View file

@ -133,7 +133,7 @@ module.exports.log_and_etagify = function(req, res, next) {
if (typeof(body) === 'object' && body != null) {
if (body.error) {
res._sinopia_error = body.error
res._sinopia_error = body.reason || body.error
}
body = JSON.stringify(body, undefined, '\t') + '\n'
}

View file

@ -10,7 +10,8 @@ module.exports = function() {
it('add tag - 404', function(cb) {
server.add_tag('testpkg-tag', 'tagtagtag', '0.0.1', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such package'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such package'))
cb()
})
})
@ -34,7 +35,8 @@ module.exports = function() {
it('add tag - bad ver', function(cb) {
server.add_tag('testpkg-tag', 'tagtagtag', '0.0.1-x', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('version doesn\'t exist'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('version doesn\'t exist'))
cb()
})
})

View file

@ -15,7 +15,8 @@ module.exports = function() {
it('trying to fetch non-existent package', function(cb) {
server.get_package('testpkg', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such package'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such package'))
cb()
})
})
@ -28,7 +29,8 @@ module.exports = function() {
it('downloading non-existent tarball', function(cb) {
server.get_tarball('testpkg', 'blahblah', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such file'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such file'))
cb()
})
})
@ -109,7 +111,8 @@ module.exports = function() {
it('uploading new package version for bad pkg', function(cb) {
server.put_version('testpxg', '0.0.1', require('./lib/package')('testpxg'), function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such package'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such package'))
cb()
})
})

View file

@ -13,7 +13,8 @@ module.exports = function() {
it('downloading non-existent tarball #1 / srv2', function(cb) {
server2.get_tarball('testpkg-gh29', 'blahblah', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such package'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such package'))
cb()
})
})
@ -32,7 +33,8 @@ module.exports = function() {
it('downloading non-existent tarball #2 / srv2', function(cb) {
server2.get_tarball('testpkg-gh29', 'blahblah', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such file'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such file'))
cb()
})
})

View file

@ -12,7 +12,8 @@ module.exports = function() {
it('testing anti-loop', function(cb) {
server2.get_package('testloop', function(res, body) {
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such package'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such package'))
cb()
})
})

View file

@ -13,7 +13,8 @@ module.exports = function() {
server.get_package('testexp_tags', function(res, body) {
// shouldn't exist yet
assert.equal(res.statusCode, 404)
assert(~body.error.indexOf('no such package'))
assert.equal(body.error, 'not_found')
assert(~body.reason.indexOf('no such package'))
cb()
})
})