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

62 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-12-02 11:19:08 +01:00
import assert from 'assert';
import {readFile} from '../lib/test.utils';
2017-12-02 11:19:08 +01:00
const getBinary = () => readFile('../fixtures/binary');
2017-12-02 11:19:08 +01:00
export default function (server, server2) {
2017-12-02 11:19:08 +01:00
test('testing anti-loop', () => {
return server2.getPackage('testloop')
.status(404)
.body_error(/no such package/);
})
;['fwd'].forEach(function (pkg) {
let prefix = pkg + ': ';
pkg = 'test' + pkg;
2017-12-02 11:19:08 +01:00
describe(pkg, () => {
beforeAll(function () {
return server.putPackage(pkg, require('../fixtures/package')(pkg))
.status(201)
.body_ok(/created new package/);
});
2017-12-02 11:19:08 +01:00
test(prefix + 'creating new package', () => {});
2017-12-02 11:19:08 +01:00
describe(pkg, () => {
beforeAll(function () {
return server.putVersion(pkg, '0.1.1', require('../fixtures/package')(pkg))
.status(201)
.body_ok(/published/);
});
2017-12-02 11:19:08 +01:00
test(prefix + 'uploading new package version', () => {});
2017-12-02 11:19:08 +01:00
test(prefix + 'uploading incomplete tarball', () => {
return server.putTarballIncomplete(pkg, pkg + '.bad', getBinary(), 3000);
});
2017-12-02 11:19:08 +01:00
describe('tarball', () => {
beforeAll(function () {
return server.putTarball(pkg, pkg + '.file', getBinary())
.status(201)
.body_ok(/.*/);
});
2017-12-02 11:19:08 +01:00
test(prefix + 'uploading new tarball', () => {
});
2017-12-02 11:19:08 +01:00
test(prefix + 'downloading tarball from server1', () => {
return server.getTarball(pkg, pkg + '.file')
.status(200)
.then(function (body) {
assert.deepEqual(body, getBinary());
});
});
});
});
});
});
2017-12-02 11:20:27 +01:00
}