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

68 lines
2 KiB
JavaScript
Raw Normal View History

2017-04-19 14:15:28 -05:00
'use strict';
const assert = require('assert');
const crypto = require('crypto');
2013-12-19 10:11:54 -05:00
function readfile(x) {
2017-04-19 14:15:28 -05:00
return require('fs').readFileSync(__dirname + '/' + x);
2013-12-19 10:11:54 -05:00
}
module.exports = function() {
const server = process.server;
const server2 = process.server2;
2013-12-29 01:40:47 -05:00
2017-04-19 14:15:28 -05:00
it('downloading non-existent tarball #1 / srv2', function() {
return server2.getTarball('testpkg-gh29', 'blahblah')
.status(404)
2017-04-19 14:15:28 -05:00
.body_error(/no such package/);
});
2013-12-19 10:11:54 -05:00
describe('pkg-gh29', function() {
2017-04-19 14:15:28 -05:00
before(function() {
return server.putPackage('testpkg-gh29', require('./fixtures/package')('testpkg-gh29'))
.status(201)
2017-04-19 14:15:28 -05:00
.body_ok(/created new package/);
});
2013-12-19 10:11:54 -05:00
2017-04-19 14:15:28 -05:00
it('creating new package / srv1', function() {});
2013-12-19 10:11:54 -05:00
2017-04-19 14:15:28 -05:00
it('downloading non-existent tarball #2 / srv2', function() {
return server2.getTarball('testpkg-gh29', 'blahblah')
.status(404)
2017-04-19 14:15:28 -05:00
.body_error(/no such file/);
});
2013-12-19 10:11:54 -05:00
describe('tarball', function() {
2017-04-19 14:15:28 -05:00
before(function() {
return server.putTarball('testpkg-gh29', 'blahblah', readfile('fixtures/binary'))
.status(201)
2017-04-19 14:15:28 -05:00
.body_ok(/.*/);
});
2013-12-19 10:11:54 -05:00
2017-04-19 14:15:28 -05:00
it('uploading new tarball / srv1', function() {});
2013-12-19 10:11:54 -05:00
describe('pkg version', function() {
2017-04-19 14:15:28 -05:00
before(function() {
const pkg = require('./fixtures/package')('testpkg-gh29');
2017-04-19 14:15:28 -05:00
pkg.dist.shasum = crypto.createHash('sha1').update(readfile('fixtures/binary')).digest('hex');
return server.putVersion('testpkg-gh29', '0.0.1', pkg)
.status(201)
2017-04-19 14:15:28 -05:00
.body_ok(/published/);
});
2013-12-19 10:11:54 -05:00
2017-04-19 14:15:28 -05:00
it('uploading new package version / srv1', function() {});
2013-12-19 10:11:54 -05:00
2017-04-19 14:15:28 -05:00
it('downloading newly created tarball / srv2', function() {
return server2.getTarball('testpkg-gh29', 'blahblah')
.status(200)
2017-04-19 14:15:28 -05:00
.then(function(body) {
assert.deepEqual(body, readfile('fixtures/binary'));
});
});
});
});
});
};
2013-12-19 10:11:54 -05:00