Skip to content

Commit

Permalink
Add additional check to negate the test
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Tusch committed Sep 4, 2015
1 parent 559e72c commit 6b79145
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ license-checker --json > /path/to/licenses.json
license-checker --csv --out /path/to/licenses.csv
license-checker --unknown
license-checker --exclude 'MIT, MIT/X11, BSD, ISC'
license-checker --onlyunknown
```

Requiring
Expand Down
29 changes: 25 additions & 4 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var tests = {
assert.equal(d, 'Undefined');
}
},
'should only list UNKNOWN licenses': {
'should only list UNKNOWN or guessed licenses successful': {
topic: function () {
var self = this;

Expand All @@ -97,7 +97,7 @@ var tests = {
self.callback(null, sorted);
});
},
'so we check if there is not a star in a license': function(d) {
'so we check if there is no license with a star or UNKNOWN found': function(d) {
var onlyStarsFound = true;
Object.keys(d).forEach(function(item) {
if (d[item].licenses && d[item].licenses.indexOf('UNKNOWN') !== -1) {
Expand All @@ -111,10 +111,31 @@ var tests = {

assert.ok(onlyStarsFound);
}
},
'should only list UNKNOWN or guessed licenses with errors (argument missing)': {
topic: function () {
var self = this;

checker.init({
start: path.join(__dirname, '../')
}, function (sorted) {
self.callback(null, sorted);
});
},
'so we check if there is no license with a star or UNKNOWN found': function(d) {
var onlyStarsFound = true;
Object.keys(d).forEach(function(item) {
if (d[item].licenses && d[item].licenses.indexOf('UNKNOWN') !== -1) {
//Okay
} else if (d[item].licenses && d[item].licenses.indexOf('*') !== -1) {
//Okay
} else {
onlyStarsFound = false;
}
});
assert.equal(onlyStarsFound, false);
}
}
};



vows.describe('license-checker').addBatch(tests).export(module);

0 comments on commit 6b79145

Please sign in to comment.