"use strict";

var app = require('../app');
var http = require('http');
var server = http.createServer(app);
var sinon = require('sinon');
var io = require('socket.io-client');
var options = {
    'force new connection' : true,
    port : 3000
};
var assert = require('power-assert');

describe('sio', function() {
    it ('sio test', function(done) {
        server.listen(3000);
        var redisClient = require("node-redis-mock").createClient();
        var spy = sinon.spy(redisClient, "hkeys");
        assert(spy.called === false);
        var sio = require('../sio')(server, redisClient);
        var socket = io.connect("http://localhost:3000", options);
        socket.on('connect', function() {
            assert(spy.called === true);
            done();
        });
    });
});

@@ -69,45 +69,8 @@
 ');%0A
-var server = http.createServer(app);%0A
 var 
@@ -279,40 +279,339 @@
     
-it ('sio test', function(done) %7B
+var server;%0A    beforeEach(function() %7B%0A        server = http.createServer(app);%0A        server.listen(3000);%0A    %7D);%0A%0A    afterEach(function() %7B%0A        server.close();%0A    %7D);%0A%0A    it ('sio test', function() %7B%0A        var redisClient = require(%22node-redis-mock%22).createClient();%0A        var spy = sinon.spy(redisClient, %22hkeys%22);
 %0A   
@@ -615,36 +615,193 @@
         
+as
 ser
-ver.listen(3000);
+t(spy.called === false);%0A        var sio = require('../sio')(server, redisClient);%0A        assert(spy.called === true);%0A    %7D);%0A%0A    it ('connection test', function(done) %7B
 %0A       
@@ -1122,49 +1122,8 @@
 ) %7B%0A
-            assert(spy.called === true);%0A
     
@@ -1158,12 +1158,13 @@
     %7D);%0A
+%0A
 %7D);%0A

update sio test.