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:
parent
d657e180d5
commit
df49fb84c1
6 changed files with 19 additions and 10 deletions
|
@ -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'
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue