-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch testing from mocha/should to tape for easier testling support
- Loading branch information
Showing
4 changed files
with
67 additions
and
57 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -12,22 +12,25 @@ | |
"email": "[email protected]" | ||
}, | ||
"dependencies": { | ||
"JSONStream": "^0.9.0", | ||
"through2": "^0.6.1", | ||
"debug": "^1.0.4", | ||
"split": "~0.3.0", | ||
"browserify": "~5.10.0", | ||
"uglify-js": "~2.4.15" | ||
"debug": "^1.0.4" | ||
}, | ||
"devDependencies": { | ||
"split": "~0.3.0", | ||
"browserify": "^5.10.0", | ||
"uglify-js": "~2.4.15", | ||
"coveralls": "~2.11.1", | ||
"docco": "~0.6.3", | ||
"istanbul": "~0.3.0", | ||
"mocha": "~1.21.4", | ||
"mocha-lcov-reporter": "0.0.1", | ||
"should": "~4.0.4" | ||
"tape": "^2.14.0", | ||
"tap-spec": "^0.2.0", | ||
"testling": "^1.7.0", | ||
"docco": "~0.6.3" | ||
}, | ||
"keywords": [ | ||
"bio", | ||
"biology", | ||
"bioinformatics", | ||
"bionode", | ||
"template", | ||
"api", | ||
"streams", | ||
|
@@ -40,11 +43,12 @@ | |
"bionode-template": "cli.js" | ||
}, | ||
"scripts": { | ||
"test": "mocha --reporter spec", | ||
"coverage": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec && rm -rf ./coverage", | ||
"coveralls": "istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage", | ||
"build-docs": "docco ./lib/bionode-template.js", | ||
"build-browser": "browserify browser.js | uglifyjs > bionode-template.min.js" | ||
"test": "node test/bionode-template.js | tap-spec", | ||
"test-browser": "browserify test/bionode-template.js | testling | tap-spec", | ||
"coverage": "istanbul cover test/bionode-template.js --report lcovonly -- | tap-spec && rm -rf ./coverage", | ||
"coveralls": "istanbul cover test/bionode-template.js --report lcovonly -- | tap-spec && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage", | ||
"build-browser": "browserify index.js -r ./index.js:bionode-template | uglifyjs > bionode-template.min.js", | ||
"build-docs": "docco ./lib/bionode-template.js" | ||
}, | ||
"license": "MIT" | ||
} |
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,49 +1,46 @@ | ||
var fs = require('fs') | ||
var split = require('split') | ||
var test = require('tape') | ||
|
||
var template = require('../') | ||
var should = require('should') | ||
|
||
require('mocha') | ||
|
||
describe("Greet", function() { | ||
|
||
var greetings | ||
var result = [ | ||
{"greeting":"Hello World"}, | ||
{"greeting":"Hello Foo"} | ||
] | ||
function test(cb) { | ||
return function() { | ||
greetings.should.eql(result) | ||
cb() | ||
} | ||
} | ||
|
||
it("should take a name argument and return object with greeting", function(done) { | ||
template.greet('World').on('data', function(data) { | ||
data.should.eql({"greeting":"Hello World"}) | ||
done() | ||
}) | ||
test('Should take a name argument and return object with greeting', function(t) { | ||
t.plan(1) | ||
template.greet('World').on('data', function(data) { | ||
t.deepEqual(data, {'greeting': 'Hello World'}) | ||
}) | ||
}) | ||
|
||
it("should write to stream and return objects with greetings", function(done) { | ||
var greet = template.greet() | ||
greet.on('data', function(data) { greetings.push(data) }) | ||
greet.on('end', test(done)) | ||
greetings = [] | ||
greet.write('World') | ||
greet.write('Foo') | ||
greet.end() | ||
}) | ||
|
||
it("should pipe to stream and return objects with greetings", function(done) { | ||
var greet = template.greet() | ||
greet.on('data', function(data) { greetings.push(data) }) | ||
greet.on('end', test(done)) | ||
greetings = [] | ||
fs.createReadStream('./test/names.txt') | ||
.pipe(split()) | ||
.pipe(greet) | ||
}) | ||
test('Should write to stream and return objects with greetings', function(t) { | ||
t.plan(1) | ||
var greet = createGreet(t) | ||
greet.write('World') | ||
greet.write('Foo') | ||
greet.end() | ||
}) | ||
|
||
|
||
test('Should pipe to stream and return objects with greetings', function(t) { | ||
t.plan(1) | ||
var greet = createGreet(t) | ||
var names = "World\nFoo" | ||
var stream = split() | ||
stream.pipe(greet) | ||
stream.write(names) | ||
stream.end() | ||
|
||
}) | ||
|
||
|
||
function createGreet(t) { | ||
var greetings = [] | ||
var result = [ | ||
{greeting: 'Hello World'}, | ||
{greeting: 'Hello Foo'} | ||
] | ||
var greet = template.greet() | ||
greet.on('data', function(data) { greetings.push(data) }) | ||
greet.on('end', function() { t.deepEqual(greetings, result) }) | ||
return greet | ||
} |