Skip to content

Instantly share code, notes, and snippets.

@lakowske
Created June 30, 2014 05:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lakowske/a3172e1c90dbf0090dcb to your computer and use it in GitHub Desktop.
Testing Process's SIGINT interception
(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