From f9f7e0759d2d1dbe88249eeadf153f4b71475c94 Mon Sep 17 00:00:00 2001 From: brianc Date: Sat, 23 Oct 2010 12:42:01 -0500 Subject: [PATCH] failing test for EventEmitter.once backwards compatibility --- test/unit/utils-tests.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/unit/utils-tests.js 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); +});