Skip to content

Commit

Permalink
add basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brianc committed Jan 2, 2012
1 parent bf255b0 commit f9c9fff
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/index.js
@@ -0,0 +1,25 @@
var MemorySocket = require(__dirname + '/../lib')

describe('MemorySocket', function() {
describe('emitSoon', function() {
describe('emitting one event', function() {
var socket = new MemorySocket();

it('emits data once', function(done) {
socket.emitSoon('data', 'hi')
socket.once('data', function(data) {
data.should.equal('hi');
done();
})
})

it('emits new data second time', function(done) {
socket.emitSoon('data', 'bye');
socket.on('data', function(data) {
data.should.equal('bye');
done();
})
})
})
})
})

0 comments on commit f9c9fff

Please sign in to comment.