mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
69d7df20d8
* chore: enable pnp yarn * chore: ignore pnp * fix type issues on run eslint * add missing dependency and fix some errors * fix most of the errors some were just disabled, already fixed in master * add missing jest-config * update jest@26 align with other deps * add missing @babel/register * clean up * use yarn node * use yarn node on release * chore: add husky 6 * chore: add husky 6 * chore: lint-stage * chore: test * chore: add hook git * chore: test * chore: test * update deps * chore: fix commit lint * fix docker run * update git ignore
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
|
|
import express from 'express';
|
|
import request from 'request';
|
|
import rimraf from 'rimraf';
|
|
import { API_ERROR } from '../../../src/lib/constants';
|
|
import endPointAPI from '../../../src/api/index';
|
|
import config from '../partials/config/index';
|
|
|
|
import { setup } from '../../../src/lib/logger';
|
|
|
|
setup([{ type: 'stdout', format: 'pretty', level: 'trace' }]);
|
|
|
|
const app = express();
|
|
const server = require('http').createServer(app);
|
|
|
|
describe('basic system test', () => {
|
|
let port;
|
|
jest.setTimeout(20000);
|
|
|
|
beforeAll(function (done) {
|
|
rimraf(__dirname + '/store/test-storage', done);
|
|
});
|
|
|
|
beforeAll(async function (done) {
|
|
app.use(await endPointAPI(config()));
|
|
|
|
server.listen(0, function () {
|
|
port = server.address().port;
|
|
done();
|
|
});
|
|
});
|
|
|
|
afterAll((done) => {
|
|
server.close(done);
|
|
});
|
|
|
|
test('server should respond on /', (done) => {
|
|
request(
|
|
{
|
|
url: 'http://localhost:' + port + '/'
|
|
},
|
|
function (err, res, body) {
|
|
expect(err).toBeNull();
|
|
expect(body).toMatch(/Verdaccio/);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
|
|
test('server should respond on /___not_found_package', (done) => {
|
|
request(
|
|
{
|
|
url: `http://localhost:${port}/___not_found_package`
|
|
},
|
|
function (err, res, body) {
|
|
expect(err).toBeNull();
|
|
expect(body).toMatch(API_ERROR.NO_PACKAGE);
|
|
done();
|
|
}
|
|
);
|
|
});
|
|
});
|