Skip to content

Commit

Permalink
ignore libcov, added warnings and fixed typo in server.js, basic unit…
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
thegoleffect committed May 8, 2012
1 parent 733a03f commit eb29245
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.tap
sftp-config.json
npm-debug.log
*.DS_Store
*.DS_Store
lib-cov
11 changes: 10 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ exports.Server = Server = function (host, port, options, routes) {

var that = this;

// Confirm that Server is called as constructor

if (this.constructor != Server) {

console.log("Please instantiate Server() with new (var x = new Server()).");
process.exit(1);
}

// Register as even emitter

Events.EventEmitter.call(this);
Expand Down Expand Up @@ -99,8 +107,9 @@ exports.Server = Server = function (host, port, options, routes) {
this.router.configure({

async: true,
notfound: this.unhandledRoute()
notfound: console.log(this) && this.unhandledRoute()
});


var listernerEntryFunc = function (req, res) {

Expand Down
26 changes: 26 additions & 0 deletions test/hapi.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var should = require("should");
var Hapi = require("../index");

var testHandler = function(hapi, reply){
reply("ohai")
}

describe("Hapi", function(){
describe(".Server", function(){
describe("#Server", function(){
it("should", function(done){
var host = "localhost",
port = 3000,
options = {

},
routes = [
{ method: 'GET', path: '/', handler: testHandler, tos: 'none', authentication: 'none' }
]

var s = new Hapi.Server.Server(host, port, options, routes);
done()
})
})
})
})

0 comments on commit eb29245

Please sign in to comment.