0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/test/unit/toplevel.js

57 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-12-22 12:58:25 -05:00
var assert = require('assert')
var express = require('express')
var request = require('request')
var rimraf = require('rimraf')
2016-11-07 12:15:38 -05:00
var verdaccio = require('../../')
2014-12-22 12:58:25 -05:00
var config = {
storage: __dirname + '/test-storage',
2014-12-22 12:58:25 -05:00
packages: {
'*': {
allow_access: '$all',
},
},
logs: [
{type: 'stdout', format: 'pretty', level: 'fatal'}
],
}
describe('toplevel', function() {
var port
before(function(done) {
rimraf(__dirname + '/test-storage', done)
})
before(function(done) {
var app = express()
2016-11-07 12:15:38 -05:00
app.use(verdaccio(config))
2014-12-22 12:58:25 -05: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) {
assert.equal(err, null)
assert(body.match(/<title>Verdaccio<\/title>/))
2014-12-22 12:58:25 -05:00
done()
})
})
it('should respond on /whatever', function(done) {
request({
url: 'http://localhost:' + port + '/whatever',
}, function(err, res, body) {
assert.equal(err, null)
2014-12-22 12:58:25 -05:00
assert(body.match(/no such package available/))
done()
})
})
})