Created
June 30, 2014 05:56
-
-
Save lakowske/a3172e1c90dbf0090dcb to your computer and use it in GitHub Desktop.
Testing Process's SIGINT interception
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
(function(Process) { | |
describe('Process', function() { | |
it('intercepts sig int', function(done) { | |
Process.on('exit', function(exitPromises) { | |
var exitProcess = new RSVP.Promise(function(resolve, reject) { | |
setTimeout(function() { | |
resolve(true); | |
}, 100); | |
}); | |
exitPromises(exitProcess); | |
}) | |
process.emit('SIGINT'); | |
}) | |
it('closes streams on sig int', function(done) { | |
var fileBuffer = {file : 'processFileBufferTestObjects.json'}; | |
var fb = new COMPOSITE.FileBuffer(fileBuffer); | |
fb.add({id : 'test'}); | |
process.emit('SIGINT'); | |
fs.unlink('processFileBufferTestObjects.json'); | |
done(); | |
}) | |
}) | |
})(COMPOSITE.Process) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment