Created
November 8, 2013 08:03
-
-
Save paolochiodi/7367759 to your computer and use it in GitHub Desktop.
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 Cover = require('../../lib/resizers/resizer_stream'); | |
var Transform = require('stream').Transform; | |
describe("ResizerStream", function() { | |
it("should be a Transform stream", function() { | |
var resizer = new Cover({ height: 100, width: 200 }); | |
expect(resizer).to.be.an.instanceof(Transform); | |
}); | |
it("should emit an error if graphics magick exits with code != 0", function(end) { | |
var stream = require('stream'); | |
var process = require('child_process'); | |
var convert = { | |
stdin: new stream.Writable(), | |
stdout: new stream.Readable(), | |
stderr: new stream.Readable() | |
}; | |
convert.stdin.on('*', function() { | |
convert.emit('error'); | |
}); | |
sinon.stub(process, 'spawn', function() { | |
console.log('spawn'); | |
return convert; | |
}); | |
var resizer = new Cover({ height: 100, width: 200 }); | |
resizer.on('error', function() { | |
end(); | |
}); | |
resizer.write('data'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment