Skip to content

Commit

Permalink
test: fix helper to take options
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Dec 24, 2012
1 parent 67f7d57 commit 1ec7667
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/socket.io.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ var request = require('supertest');
var expect = require('expect.js');

// creates a socket.io client for the given server
function client(srv, nsp){
function client(srv, nsp, opts){
if ('object' == typeof nsp) {
opts = nsp;
nsp = null;
}
var addr = srv.address();
if (!addr) addr = srv.listen().address();
return ioc('ws://' + addr.address + ':' + addr.port + (nsp || ''));
var url = 'ws://' + addr.address + ':' + addr.port + (nsp || '');
return ioc(url, opts);
}

describe('socket.io', function(){
Expand Down

0 comments on commit 1ec7667

Please sign in to comment.