mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
test suite for #29 (nothing is fixed yet)
This commit is contained in:
parent
380ec1e917
commit
19e4d78197
4 changed files with 49 additions and 2 deletions
46
test/gh29.js
Normal file
46
test/gh29.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
var assert = require('assert')
|
||||
, readfile = require('fs').readFileSync
|
||||
, ex = module.exports
|
||||
, server = process.server
|
||||
, server2 = process.server2
|
||||
|
||||
ex['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'))
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
||||
ex['creating new package / srv1'] = function(cb) {
|
||||
server.put_package('testpkg-gh29', require('./lib/package')('testpkg-gh29'), function(res, body) {
|
||||
assert.equal(res.statusCode, 201)
|
||||
assert(~body.ok.indexOf('created new package'))
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
||||
ex['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'))
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
||||
ex['uploading new tarball / srv1'] = function(cb) {
|
||||
server.put_tarball('testpkg-gh29', 'blahblah', readfile('fixtures/binary'), function(res, body) {
|
||||
assert.equal(res.statusCode, 201)
|
||||
assert(body.ok)
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
||||
ex['downloading newly created tarball / srv2'] = function(cb) {
|
||||
server2.get_tarball('testpkg-gh29', 'blahblah', function(res, body) {
|
||||
assert.equal(res.statusCode, 200)
|
||||
assert.deepEqual(body, readfile('fixtures/binary').toString('utf8'))
|
||||
cb()
|
||||
})
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ ex['testing anti-loop'] = function(cb) {
|
|||
})
|
||||
}
|
||||
|
||||
['fwd', /*'loop'*/].forEach(function(pkg) {
|
||||
;['fwd', /*'loop'*/].forEach(function(pkg) {
|
||||
var prefix = pkg + ': '
|
||||
pkg = 'test' + pkg
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ ex['starting servers'] = function(cb) {
|
|||
|
||||
ex['authentication to servers'] = function(cb) {
|
||||
var count = 0
|
||||
[server, server2].forEach(function(server) {
|
||||
;[server, server2].forEach(function(server) {
|
||||
count++
|
||||
server.auth('test', 'test', function(res, body) {
|
||||
assert.equal(res.statusCode, 201)
|
||||
|
|
|
@ -18,6 +18,7 @@ ex['Basic:'] = require('./basic')
|
|||
ex['Mirror:'] = require('./mirror')
|
||||
ex['Race:'] = require('./race')
|
||||
ex['Tags:'] = require('./tags')
|
||||
ex['GH29:'] = require('./gh29')
|
||||
|
||||
process.on('exit', function() {
|
||||
if (forks[0]) forks[0].kill()
|
||||
|
|
Loading…
Add table
Reference in a new issue