2014-12-22 18:58:25 +01:00
|
|
|
var assert = require('assert')
|
|
|
|
var express = require('express')
|
|
|
|
var request = require('request')
|
|
|
|
var rimraf = require('rimraf')
|
2016-11-07 18:15:38 +01:00
|
|
|
var verdaccio = require('../../')
|
2017-04-10 22:00:41 +02:00
|
|
|
var config = require('./partials/config');
|
2014-12-22 18:58:25 +01:00
|
|
|
|
|
|
|
describe('toplevel', function() {
|
|
|
|
var port
|
|
|
|
|
|
|
|
before(function(done) {
|
|
|
|
rimraf(__dirname + '/test-storage', done)
|
|
|
|
})
|
|
|
|
|
|
|
|
before(function(done) {
|
|
|
|
var app = express()
|
2016-11-07 18:15:38 +01:00
|
|
|
app.use(verdaccio(config))
|
2014-12-22 18:58:25 +01:00
|
|
|
|
|
|
|
var server = require('http').createServer(app)
|
|
|
|
server.listen(0, function() {
|
|
|
|
port = server.address().port
|
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should respond on /', function(done) {
|
|
|
|
request({
|
|
|
|
url: 'http://localhost:' + port + '/',
|
|
|
|
}, function(err, res, body) {
|
2015-03-28 19:25:53 +01:00
|
|
|
assert.equal(err, null)
|
2016-08-20 19:07:52 +02:00
|
|
|
assert(body.match(/<title>Verdaccio<\/title>/))
|
2014-12-22 18:58:25 +01:00
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should respond on /whatever', function(done) {
|
|
|
|
request({
|
|
|
|
url: 'http://localhost:' + port + '/whatever',
|
|
|
|
}, function(err, res, body) {
|
2015-03-28 19:25:53 +01:00
|
|
|
assert.equal(err, null)
|
2014-12-22 18:58:25 +01:00
|
|
|
assert(body.match(/no such package available/))
|
|
|
|
done()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|