Browse Source

plugin s/not_found/notFound/

master
Brett Langdon 12 years ago
parent
commit
1a09f8bee4
2 changed files with 7 additions and 8 deletions
  1. +1
    -2
      lib/plugin.js
  2. +6
    -6
      test/plugin.js

+ 1
- 2
lib/plugin.js View File

@ -2,7 +2,7 @@ var plugin = function(){};
plugin.prototype.on = function(event, handler){
if(event == "not-found" || event == "404"){
this.not_found = handler;
this.notFound = handler;
} else if(event == "setup"){
this.setup = this.setup || [];
this.setup.push(handler);
@ -43,5 +43,4 @@ plugin.prototype.PATCH = function(route, handler){
this.addRoute("PATCH", route, handler);
};
module.exports = plugin;

+ 6
- 6
test/plugin.js View File

@ -105,8 +105,8 @@ suite("Plugin.on", function(){
var handler = function(request, server, done){};
plugin.on("not-found", handler);
assert.ok(plugin.not_found);
assert.equal(plugin.not_found, handler);
assert.ok(plugin.notFound);
assert.equal(plugin.notFound, handler);
});
test("calling on not-found twice should overwrite not-found handler", function(){
@ -115,8 +115,8 @@ suite("Plugin.on", function(){
plugin.on("not-found", false);
plugin.on("not-found", handler);
assert.ok(plugin.not_found);
assert.equal(plugin.not_found, handler);
assert.ok(plugin.notFound);
assert.equal(plugin.notFound, handler);
});
test("on 404 should set not-found handler", function(){
@ -124,8 +124,8 @@ suite("Plugin.on", function(){
var handler = function(request, server, done){};
plugin.on("404", handler);
assert.ok(plugin.not_found);
assert.equal(plugin.not_found, handler);
assert.ok(plugin.notFound);
assert.equal(plugin.notFound, handler);
});
test("on with unknown event should raise Error", function(){


Loading…
Cancel
Save