Skip to content

Commit

Permalink
test: added args + callback events tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Dec 18, 2012
1 parent ecf937c commit ae516a3
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion test/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,42 @@ describe('socket.io', function(){
s.emit('hi', function(){
done();
});
socket.on('hi', function(fn){
});
});
});

it('should receive events with args and callback', 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(a, b, fn){
expect(a).to.be(1);
expect(b).to.be(2);
fn();
});
socket.emit('woot', 1, 2, function(){
done();
});
});
});
});

it('should emit events with args and callback', function(done){
var srv = http();
var sio = io(srv);
srv.listen(function(){
var socket = client(srv);
sio.on('connection', function(s){
socket.on('hi', function(a, b, fn){
expect(a).to.be(1);
expect(b).to.be(2);
fn();
});
s.emit('hi', 1, 2, function(){
done();
});
});
});
});
Expand Down

0 comments on commit ae516a3

Please sign in to comment.