0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/functional/mirror.js

65 lines
1.8 KiB
JavaScript
Raw Normal View History

2013-12-19 10:11:54 -05:00
var assert = require('assert')
function readfile(x) {
return require('fs').readFileSync(__dirname + '/' + x)
2013-12-19 10:11:54 -05:00
}
module.exports = function() {
var server = process.server
var server2 = process.server2
2013-12-29 01:40:47 -05:00
it('testing anti-loop', function () {
return server2.get_package('testloop')
.status(404)
.body_error(/no such package/)
})
2013-12-19 10:11:54 -05:00
;['fwd', /*'loop'*/].forEach(function(pkg) {
var prefix = pkg + ': '
pkg = 'test' + pkg
2013-12-19 10:11:54 -05:00
describe(pkg, function() {
before(function () {
return server.put_package(pkg, require('./lib/package')(pkg))
.status(201)
.body_ok(/created new package/)
})
2013-12-19 10:11:54 -05:00
it(prefix+'creating new package', function(){})
2013-12-19 10:11:54 -05:00
describe(pkg, function() {
before(function () {
return server.put_version(pkg, '0.1.1', require('./lib/package')(pkg))
.status(201)
.body_ok(/published/)
})
2013-12-19 10:11:54 -05:00
it(prefix+'uploading new package version', function(){})
2013-12-19 10:11:54 -05:00
it(prefix+'uploading incomplete tarball', function () {
return server.put_tarball_incomplete(pkg, pkg+'.bad', readfile('fixtures/binary'), 3000)
})
2013-12-19 10:11:54 -05:00
describe('tarball', function() {
before(function () {
return server.put_tarball(pkg, pkg+'.file', readfile('fixtures/binary'))
.status(201)
.body_ok(/.*/)
})
2013-12-19 10:11:54 -05:00
it(prefix+'uploading new tarball', function(){})
2013-12-29 01:40:47 -05:00
it(prefix+'downloading tarball from server1', function () {
return server.get_tarball(pkg, pkg+'.file')
.status(200)
.then(function (body) {
assert.deepEqual(body, readfile('fixtures/binary').toString('utf8'))
})
})
})
})
})
})
2013-12-19 10:11:54 -05:00
}