Skip to content

Commit

Permalink
Added not check and a proper test
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Feb 26, 2014
1 parent 40d6e25 commit 7d04195
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/license.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var MIT_LICENSE = ["Permission is hereby granted, free of charge, to any person


module.exports = function(str) {
if (typeof str == 'undefined') {
if (typeof str === 'undefined' || !str) {
return 'Undefined';
} else if (str.indexOf('MIT') > -1 || str.indexOf(MIT_LICENSE) > -1) {
return 'MIT*';
Expand Down
9 changes: 9 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ var tests = {
assert.isTrue(Object.keys(d).length > 20);
}
}
},
'should not error': {
topic: function () {
var lic = require('../lib/license.js');
return lic();
},
'on undefined': function (d) {
assert.equal(d, 'Undefined');
}
}
};

Expand Down

0 comments on commit 7d04195

Please sign in to comment.