0.1.0 • Published 13 years ago
assert2 v0.1.0
Extends Node.js's assert with two new tests for events:
var assert = require('assert2'),
events = require('events'),
emitter = new events.EventEmitter();
assert.emits(emitter, 'event', function () {
emitter.emit('event');
});
assert.doesNotEmit(emitter, 'event', function () {
// zero-emissions code
});SemVer compliant
API
All of Node's assert tests, plus:
assert.emits(emitter, event, block, message)
Expects emitter to emit event while executing block. If untrue, throws
an exception with a default message which you may override with message.
assert.doesNotEmit(emitter, event, block, message)
Expects emitter not to emit event while executing block. If untrue,
throws an exception with a default message which you may override with
message.
License
MIT
0.1.0
13 years ago