Last active
August 29, 2015 14:11
-
-
Save roryf/a80d88211ad952c3291b to your computer and use it in GitHub Desktop.
How do I test this?
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
module.exports = function(input, output, cb) { | |
input.on('data', function(chunk) { | |
// do somethink with chunk, possibly transform it | |
output.write(chunk); | |
}); | |
input.on('end', function() { | |
cb(); | |
}); | |
}; |
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
var Readable = require('stream').Readable; | |
var Writable = require('stream').Writable; | |
var test = require('tape'); | |
var subject = require('./subject'); | |
test('it writes input to output stream', function(t) { | |
var result = ''; | |
var input = new Readable(); | |
var output = new Writable(); | |
subject(input, output, function() { | |
t.equal(result, 'I have no idea what I am doing.'); | |
t.end(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment