0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/functional/sanity/mirror.js
Juan Picado @jotadeveloper e00e41b24b refactor: fix linting
2018-01-07 07:59:36 +00:00

61 lines
1.7 KiB
JavaScript

import assert from 'assert';
import {readFile} from '../lib/test.utils';
const getBinary = () => readFile('../fixtures/binary');
export default function (server, server2) {
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;
describe(pkg, () => {
beforeAll(function () {
return server.putPackage(pkg, require('../fixtures/package')(pkg))
.status(201)
.body_ok(/created new package/);
});
test(prefix + 'creating new package', () => {});
describe(pkg, () => {
beforeAll(function () {
return server.putVersion(pkg, '0.1.1', require('../fixtures/package')(pkg))
.status(201)
.body_ok(/published/);
});
test(prefix + 'uploading new package version', () => {});
test(prefix + 'uploading incomplete tarball', () => {
return server.putTarballIncomplete(pkg, pkg + '.bad', getBinary(), 3000);
});
describe('tarball', () => {
beforeAll(function () {
return server.putTarball(pkg, pkg + '.file', getBinary())
.status(201)
.body_ok(/.*/);
});
test(prefix + 'uploading new tarball', () => {
});
test(prefix + 'downloading tarball from server1', () => {
return server.getTarball(pkg, pkg + '.file')
.status(200)
.then(function (body) {
assert.deepEqual(body, getBinary());
});
});
});
});
});
});
}