mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-16 11:02:12 +08:00
40 lines
952 B
JavaScript
40 lines
952 B
JavaScript
var Server = require('../lib/server')
|
|
, Db = require('../lib/db').Db
|
|
, Store = require('../lib/db').Store
|
|
, Router = require('../lib/router');
|
|
|
|
describe('Server', function() {
|
|
describe('.listen()', function() {
|
|
it('should start a new deployd server', function(done) {
|
|
var server = new Server()
|
|
, defaultOptions = {
|
|
port: 2403,
|
|
// host: 'localhost',
|
|
db: {
|
|
name: 'deployd',
|
|
port: 27017,
|
|
host: '127.0.0.1'
|
|
}
|
|
};
|
|
|
|
server.listen();
|
|
expect(server.db instanceof Db).to.equal(true);
|
|
expect(server.options).to.eql(defaultOptions);
|
|
server.on('listening', function () {
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('.createStore(namespace)', function() {
|
|
it('should create a store with the given name', function() {
|
|
var server = new Server()
|
|
, store = server.createStore('foo');
|
|
|
|
expect(store instanceof Store).to.equal(true);
|
|
expect(server.stores.foo).to.equal(store);
|
|
});
|
|
});
|
|
|
|
});
|