0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/unit/basic_system.spec.js
Juan Picado @jotadeveloper 7d9736eaba
fix: wrong import reference
2018-01-18 07:03:21 +01:00

53 lines
1.2 KiB
JavaScript

'use strict';
const assert = require('assert');
const express = require('express');
const request = require('request');
const rimraf = require('rimraf');
const verdaccio = require('../../src/api/index');
const config = require('./partials/config');
const app = express();
const server = require('http').createServer(app);
describe('basic system test', () => {
let port;
beforeAll(function(done) {
rimraf(__dirname + '/store/test-storage', done);
});
beforeAll(function(done) {
app.use(verdaccio(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) {
assert.equal(err, null);
assert(body.match(/<title>Verdaccio<\/title>/));
done();
});
});
test('server should respond on /whatever', done => {
request({
url: 'http://localhost:' + port + '/whatever',
}, function(err, res, body) {
assert.equal(err, null);
assert(body.match(/no such package available/));
done();
});
});
});