0.1.0 • Published 11 years ago

assert2 v0.1.0

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

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