diff --git a/test/unit/utils-tests.js b/test/unit/utils-tests.js new file mode 100644 index 00000000..63e233d6 --- /dev/null +++ b/test/unit/utils-tests.js @@ -0,0 +1,19 @@ +require(__dirname + '/test-helper'); + +//this tests the monkey patching +//to ensure comptability with older +//versions of node +test("EventEmitter.once", function() { + + //an event emitter + var stream = new MemoryStream(); + + var callCount = 0; + stream.once('single', function() { + callCount++; + }); + + stream.emit('single'); + stream.emit('single'); + assert.equal(callCount, 1); +});