Created
September 19, 2010 07:07
-
-
Save brettstimmerman/586509 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
This Vows test suite produces the following spec output with vows 0.5.1 and | |
node 0.2.1. | |
♢ Emitter | |
A NonEmitter does not inherit from EventEmitter | |
✓ and can be tested | |
✗ Errored » Emitter: An Emitter inherits from EventEmitter ∙ not fired! | |
✗ Errored » 1 honored ∙ 1 errored ∙ 1 dropped | |
*/ | |
var assert = require('assert'), | |
events = require('events'), | |
vows = require('vows'); | |
function Emitter () {} | |
Emitter.prototype = new events.EventEmitter(); | |
function NonEmitter () {} | |
vows.describe('Inheriting from EventEmitter').addBatch({ | |
'An Emitter': { | |
'inherits from EventEmitter': { | |
topic: function () { | |
return new Emitter(); | |
}, | |
'but cannot be tested': function (topic) { | |
// this will never run | |
assert.instanceOf(topic, Emitter); | |
} | |
} | |
}, | |
'A NonEmitter': { | |
'does not inherit from EventEmitter': { | |
topic: function () { | |
return new NonEmitter(); | |
}, | |
'and can be tested': function (topic) { | |
assert.instanceOf(topic, NonEmitter); | |
} | |
} | |
} | |
}).export(module); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment