mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-17 07:45:52 +01:00
66f4197236
* chore: test * chore: add * chore: more progress * chore: progress in migration, fix prettier parser * chore: reduce tsc errors * chore: refactor storage utils types * chore: refactor utils types * chore: refactor local storage types * chore: refactor config utils types * chore: refactor tsc types * refactor: apply eslint fix, tabs etc * chore: fix lint errors * test: update unit test conf to typescript setup few test refactored to typescript * chore: enable more unit test migrate to typescript * chore: migrate storage test to tsc * chore: migrate up storage test to tsc * refactor: enable plugin and auth test * chore: migrate plugin loader test * chore: update dependencies * chore: migrate functional test to typescript * chore: add codecove * chore: update express * chore: downgrade puppeteer The latest version does not seems to work properly fine. * chore: update dependencies
72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import fs from 'fs';
|
|
import path from 'path';
|
|
import {TARBALL} from '../config.functional';
|
|
import {HTTP_STATUS} from "../../../src/lib/constants";
|
|
import {createTarballHash} from "../../../src/lib/crypto-utils";
|
|
import requirePackage from '../fixtures/package';
|
|
|
|
function readfile(filePath) {
|
|
const folder = path.join(__dirname , filePath);
|
|
|
|
return fs.readFileSync(folder);
|
|
}
|
|
|
|
const binary = '../fixtures/binary';
|
|
const pkgName = 'testpkg-gh29';
|
|
|
|
export default function (server, server2) {
|
|
describe('pkg-gh29 #1', () => {
|
|
test('downloading non-existent tarball #1 / srv2', () => {
|
|
return server2.getTarball(pkgName, TARBALL)
|
|
.status(HTTP_STATUS.NOT_FOUND)
|
|
.body_error(/no such package/);
|
|
});
|
|
});
|
|
|
|
describe('pkg-gh29 #2', () => {
|
|
beforeAll(function() {
|
|
return server.putPackage(pkgName, requirePackage(pkgName))
|
|
.status(HTTP_STATUS.CREATED)
|
|
.body_ok(/created new package/);
|
|
});
|
|
|
|
test('creating new package / srv1', () => {});
|
|
|
|
test('downloading non-existent tarball #2 / srv2', () => {
|
|
return server2.getTarball(pkgName, TARBALL)
|
|
.status(HTTP_STATUS.NOT_FOUND)
|
|
.body_error(/no such file available/);
|
|
});
|
|
|
|
describe('tarball', () => {
|
|
beforeAll(function() {
|
|
return server.putTarball(pkgName, TARBALL, readfile(binary))
|
|
.status(HTTP_STATUS.CREATED)
|
|
.body_ok(/.*/);
|
|
});
|
|
|
|
test('uploading new tarball / srv1', () => {});
|
|
|
|
describe('pkg version', () => {
|
|
beforeAll(function() {
|
|
const pkg = requirePackage(pkgName);
|
|
pkg.dist.shasum = createTarballHash().update(readfile(binary)).digest('hex');
|
|
return server.putVersion(pkgName, '0.0.1', pkg)
|
|
.status(HTTP_STATUS.CREATED)
|
|
.body_ok(/published/);
|
|
});
|
|
|
|
test('uploading new package version / srv1', () => {});
|
|
|
|
test('downloading newly created tarball / srv2', () => {
|
|
return server2.getTarball(pkgName, TARBALL)
|
|
.status(HTTP_STATUS.OK)
|
|
.then(function(body) {
|
|
expect(body).toEqual(readfile(binary));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|