Skip to content

Commit

Permalink
Added some better tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Feb 21, 2014
1 parent 2dbcac3 commit 6f390ff
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 38 deletions.
83 changes: 45 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
{
"name": "license-checker",
"description": "Check license info for a pacakge",
"author": "Dav Glass <[email protected]>",
"version": "0.0.5",
"dependencies": {
"mkdirp": "*",
"treeify": "*",
"nopt": "*",
"read-installed": "*"
},
"devDependencies": {
"yui-lint": "~0.1.1",
"jshint": "~1.1.0",
"vows": "*",
"istanbul": "*"
},
"keywords": [
"license", "cli", "checker", "oss"
],
"main": "./lib/index.js",
"bin": {
"license-checker": "./bin/license-checker"
},
"scripts": {
"pretest": "jshint --config ./node_modules/yui-lint/jshint.json ./lib/",
"test": "istanbul cover --print both vows -- --spec ./tests/*.js"
},
"preferGlobal": "true",
"bugs": { "url" : "https://github.com/davglass/license-checker/issues" },
"licenses":[
{
"type" : "BSD",
"url" : "https://github.com/davglass/license-checker/blob/master/LICENSE"
}
],
"repository": {
"type":"git",
"url":"https://github.com/davglass/license-checker.git"
"name": "license-checker",
"description": "Check license info for a pacakge",
"author": "Dav Glass <[email protected]>",
"version": "0.0.5",
"dependencies": {
"mkdirp": "^0.3.5",
"treeify": "^1.0.1",
"nopt": "^2.2.0",
"read-installed": "^1.0.0"
},
"devDependencies": {
"yui-lint": "~0.1.1",
"jshint": "~1.1.0",
"vows": "*",
"istanbul": "*",
"request": "^2.34.0",
"queue": "^1.0.0"
},
"keywords": [
"license",
"cli",
"checker",
"oss"
],
"main": "./lib/index.js",
"bin": {
"license-checker": "./bin/license-checker"
},
"scripts": {
"pretest": "jshint --config ./node_modules/yui-lint/jshint.json ./lib/",
"test": "istanbul cover --print both vows -- --spec ./tests/*.js"
},
"preferGlobal": "true",
"bugs": {
"url": "https://github.com/davglass/license-checker/issues"
},
"licenses": [
{
"type": "BSD",
"url": "https://github.com/davglass/license-checker/blob/master/LICENSE"
}
],
"repository": {
"type": "git",
"url": "https://github.com/davglass/license-checker.git"
}
}
32 changes: 32 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var vows = require('vows'),
assert = require('assert'),
path = require('path'),
checker = require('../lib/index');

var tests = {
Expand All @@ -13,6 +14,37 @@ var tests = {
'should load print': function(topic) {
assert.isFunction(topic.print);
}
},
'should parse local with unknown': {
topic: function () {
var self = this;

checker.init({
start: path.join(__dirname, '../')
}, function (sorted) {
self.callback(null, sorted);
});
},
'and give us results': function (d) {
assert.isTrue(Object.keys(d).length > 70);
assert.equal(d['[email protected]'].licenses, 'MIT');
},
'should parse local without unknown': {
topic: function () {
var self = this;

checker.init({
start: path.join(__dirname, '../'),
unknown: true
}, function (sorted) {
self.callback(null, sorted);
});
},
'and give us results': function (d) {
assert.equal(d['[email protected]'].licenses, 'BSD*');
assert.isTrue(Object.keys(d).length > 20);
}
}
}
};

Expand Down

0 comments on commit 6f390ff

Please sign in to comment.