mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
93468211d6
* chore: update eslint * chore: update rules and style * chore: aling formatting * chore: update ci rules * chore: aling formatting * chore: aling formatting
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import endPointAPI from '../../../src/api/index';
|
|
import { API_ERROR } from '../../../src/lib/constants';
|
|
|
|
import express from 'express';
|
|
import request from 'request';
|
|
import rimraf from 'rimraf';
|
|
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();
|
|
}
|
|
);
|
|
});
|
|
});
|