-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
334 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ CVS/ | |
.com.apple.timemachine.supported | ||
coverage/ | ||
.idea/ | ||
artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
reporting: | ||
reports: | ||
- lcov | ||
- text | ||
- text-summary | ||
check: | ||
global: | ||
statements: 95 | ||
lines: 95 | ||
branches: 90 | ||
functions: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ before_install: | |
node_js: | ||
- "0.10" | ||
- "0.12" | ||
- "4.1" | ||
- "4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
var vows = require('vows'), | ||
assert = require('assert'), | ||
var assert = require('assert'), | ||
path = require('path'), | ||
spawn = require('child_process').spawn; | ||
|
||
var tests = { | ||
bin: { | ||
topic: function() { | ||
var test = this; | ||
spawn( | ||
'node', [path.join(__dirname, '../bin/license-checker')], { | ||
stdio: 'ignore' | ||
} | ||
).on('exit', function(code) { | ||
test.callback(code === 0); | ||
}); | ||
}, | ||
'exits with code 0': function(code) { | ||
assert.ok(code); | ||
}, | ||
} | ||
}; | ||
|
||
vows.describe('license-checker').addBatch(tests).export(module); | ||
describe('bin/license-checker', function() { | ||
this.timeout(8000); | ||
it('should exit 0', function(done) { | ||
spawn('node', [path.join(__dirname, '../bin/license-checker')], { | ||
cwd: path.join(__dirname, '../'), | ||
stdio: 'ignore' | ||
}).on('exit', function(code) { | ||
assert.equal(code, 0); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,63 @@ | ||
var vows = require('vows'), | ||
assert = require('assert'), | ||
var assert = require('assert'), | ||
license = require('../lib/license'); | ||
|
||
var tests = { | ||
loading: { | ||
topic: function() { | ||
return license; | ||
}, | ||
'should be a function': function(topic) { | ||
assert.isFunction(topic); | ||
} | ||
}, | ||
'undefined check': { | ||
topic: function() { | ||
return license(undefined); | ||
}, | ||
'should return Undefined': function(data) { | ||
assert.equal(data, 'Undefined'); | ||
} | ||
}, | ||
'MIT check': { | ||
topic: function() { | ||
return license('asdf\nasdf\nasdf\nPermission is hereby granted, free of charge, to any'); | ||
}, | ||
'should return MIT': function(data) { | ||
assert.equal(data, 'MIT*'); | ||
} | ||
}, | ||
'MIT word check': { | ||
topic: function() { | ||
return license('asdf\nasdf\nMIT\nasdf\n'); | ||
}, | ||
'should return MIT': function(data) { | ||
assert.equal(data, 'MIT*'); | ||
} | ||
}, | ||
'BSD check': { | ||
topic: function() { | ||
return license('asdf\nRedistribution and use in source and binary forms, with or without\nasdf\n'); | ||
}, | ||
'should return BSD': function(data) { | ||
assert.equal(data, 'BSD*'); | ||
} | ||
}, | ||
'BSD word check': { | ||
topic: function() { | ||
return license('asdf\nasdf\nBSD\nasdf\n'); | ||
}, | ||
'should return BSD': function(data) { | ||
assert.equal(data, 'BSD*'); | ||
} | ||
}, | ||
'Apache word check': { | ||
topic: function() { | ||
return license('asdf\nasdf\nApache License\nasdf\n'); | ||
}, | ||
'should return Apache': function(data) { | ||
assert.equal(data, 'Apache*'); | ||
} | ||
}, | ||
'WTF check': { | ||
topic: function() { | ||
return license('DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE'); | ||
}, | ||
'should return WTFPL': function(data) { | ||
assert.equal(data, 'WTFPL*'); | ||
} | ||
}, | ||
'WTF word check': { | ||
topic: function() { | ||
return license('asdf\nasdf\nWTFPL\nasdf\n'); | ||
}, | ||
'should return WTFPL': function(data) { | ||
assert.equal(data, 'WTFPL*'); | ||
} | ||
}, | ||
'ISC check': { | ||
topic: function() { | ||
return license('asdfasdf\nThe ISC License\nasdfasdf'); | ||
}, | ||
'should return ISC': function(data) { | ||
assert.equal(data, 'ISC*'); | ||
} | ||
}, | ||
'ISC word check': { | ||
topic: function() { | ||
return license('asdf\nasdf\nISC\nasdf\n'); | ||
}, | ||
'should return ISC': function(data) { | ||
assert.equal(data, 'ISC*'); | ||
} | ||
}, | ||
'Check for null': { | ||
topic: function() { | ||
return license('this is empty, hi'); | ||
}, | ||
'should return null': function(data) { | ||
assert.equal(data, null); | ||
} | ||
} | ||
}; | ||
describe('license parser', function() { | ||
|
||
vows.describe('licenses').addBatch(tests).export(module); | ||
it('should export a function', function() { | ||
assert.equal(typeof license, 'function'); | ||
}); | ||
|
||
it('undefined check', function() { | ||
assert.equal(license(undefined), 'Undefined'); | ||
}); | ||
|
||
it('MIT check', function() { | ||
var data = license('asdf\nasdf\nasdf\nPermission is hereby granted, free of charge, to any'); | ||
assert.equal(data, 'MIT*'); | ||
}); | ||
|
||
it('MIT word check', function() { | ||
var data = license('asdf\nasdf\nMIT\nasdf\n'); | ||
assert.equal(data, 'MIT*'); | ||
}); | ||
|
||
it('BSD check', function() { | ||
var data = license('asdf\nRedistribution and use in source and binary forms, with or without\nasdf\n'); | ||
assert.equal(data, 'BSD*'); | ||
}); | ||
|
||
it('BSD word check', function() { | ||
var data = license('asdf\nasdf\nBSD\nasdf\n'); | ||
assert.equal(data, 'BSD*'); | ||
}); | ||
|
||
it('Apache word check', function() { | ||
var data = license('asdf\nasdf\nApache License\nasdf\n'); | ||
assert.equal(data, 'Apache*'); | ||
}); | ||
|
||
it('WTF check', function() { | ||
var data = license('DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE'); | ||
assert.equal(data, 'WTFPL*'); | ||
}); | ||
|
||
it('WTF word check', function() { | ||
var data = license('asdf\nasdf\nWTFPL\nasdf\n'); | ||
assert.equal(data, 'WTFPL*'); | ||
}); | ||
|
||
it('ISC check', function() { | ||
var data = license('asdfasdf\nThe ISC License\nasdfasdf'); | ||
assert.equal(data, 'ISC*'); | ||
}); | ||
|
||
it('ISC word check', function() { | ||
var data = license('asdf\nasdf\nISC\nasdf\n'); | ||
assert.equal(data, 'ISC*'); | ||
}); | ||
|
||
it('Check for null', function() { | ||
var data = license('this is empty, hi'); | ||
assert.equal(data, null); | ||
}); | ||
}); |
Oops, something went wrong.