Skip to content

Commit

Permalink
test: added event ack tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Dec 18, 2012
1 parent 381bc42 commit d1def44
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,39 @@ describe('socket.io', function(){
});
});
});

it('should receive event with callbacks', function(done){
var srv = http();
var sio = io(srv);
srv.listen(function(){
var socket = client(srv);
sio.on('connection', function(s){
s.on('woot', function(fn){
fn(1, 2);
});
socket.emit('woot', function(a, b){
expect(a).to.be(1);
expect(b).to.be(2);
done();
});
});
});
});

it('should emit events with callbacks', function(done){
var srv = http();
var sio = io(srv);
srv.listen(function(){
var socket = client(srv);
sio.on('connection', function(s){
s.emit('hi', function(){
done();
});
socket.on('hi', function(fn){
fn();
});
});
});
});
});
});

0 comments on commit d1def44

Please sign in to comment.