1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/functional/gh29.js

63 lines
1.9 KiB
JavaScript
Raw Normal View History

2017-12-02 11:19:08 +01:00
import assert from 'assert';
import crypto from 'crypto';
2013-12-19 16:11:54 +01:00
function readfile(x) {
2017-04-19 21:15:28 +02:00
return require('fs').readFileSync(__dirname + '/' + x);
2013-12-19 16:11:54 +01:00
}
2017-12-02 11:19:08 +01:00
export default function (server, server2) {
2013-12-29 07:40:47 +01:00
2017-12-02 11:19:08 +01:00
test('downloading non-existent tarball #1 / srv2', () => {
return server2.getTarball('testpkg-gh29', 'blahblah')
.status(404)
2017-04-19 21:15:28 +02:00
.body_error(/no such package/);
});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
describe('pkg-gh29', () => {
beforeAll(function() {
return server.putPackage('testpkg-gh29', require('./fixtures/package')('testpkg-gh29'))
.status(201)
2017-04-19 21:15:28 +02:00
.body_ok(/created new package/);
});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
test('creating new package / srv1', () => {});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
test('downloading non-existent tarball #2 / srv2', () => {
return server2.getTarball('testpkg-gh29', 'blahblah')
.status(404)
.body_error(/no such file available/);
2017-04-19 21:15:28 +02:00
});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
describe('tarball', () => {
beforeAll(function() {
return server.putTarball('testpkg-gh29', 'blahblah', readfile('fixtures/binary'))
.status(201)
2017-04-19 21:15:28 +02:00
.body_ok(/.*/);
});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
test('uploading new tarball / srv1', () => {});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
describe('pkg version', () => {
beforeAll(function() {
const pkg = require('./fixtures/package')('testpkg-gh29');
2017-04-19 21:15:28 +02: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 21:15:28 +02:00
.body_ok(/published/);
});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
test('uploading new package version / srv1', () => {});
2013-12-19 16:11:54 +01:00
2017-12-02 11:19:08 +01:00
test('downloading newly created tarball / srv2', () => {
return server2.getTarball('testpkg-gh29', 'blahblah')
.status(200)
.then(function(body) {
assert.deepEqual(body, readfile('fixtures/binary'));
});
2017-04-19 21:15:28 +02:00
});
});
});
});
2017-12-02 11:19:08 +01:00
}