var   _             = require('underscore')
    , th            = require('../support/test_helper.js')
    , assert        = require('assert')
    , Windshaft     = require('../../lib/windshaft')
    , serverOptions = require('../support/server_options')
    , tests         = module.exports = {};

suite('windshaft', function() {

    test('true',  function() {
        assert.equal(global.environment.name, 'test');
    });

    test('can instantiate a Windshaft object (configured express instance)',  function(){
        var ws = new Windshaft.Server(serverOptions);
        assert.ok(ws);
    });

    test('can spawn a new server on the global listen port',  function(){
        var ws = new Windshaft.Server(serverOptions);
        ws.listen(global.environment.windshaft_port);
        assert.ok(ws);
        ws.close(); /* allow proper tear down */
    });

    test('throws exception if incorrect options passed in',  function(){
        assert.throws(
            function(){
                var ws = new Windshaft.Server({unbuffered_logging:true});
            }, /Must initialise Windshaft with a base URL and req2params function/
        );
    });

    test('options are set on main windshaft object',  function(){
        var ws = new Windshaft.Server(serverOptions);
        assert.ok(_.isFunction(ws.req2params));
        assert.equal(ws.base_url, '/database/:dbname/table/:table');
    });

});

@@ -659,35 +659,39 @@
 ort',  function(
+done
 )%7B%0A
-
         var ws =
@@ -779,19 +779,33 @@
 aft_port
-);%0A
+, function() %7B%0A  
         
@@ -827,16 +827,18 @@
         
+ 
+ 
 ws.close
@@ -838,16 +838,20 @@
 s.close(
+done
 ); /* al
@@ -874,16 +874,28 @@
 down */%0A
+        %7D);%0A
     %7D);%0A

Fix listen/close test to properly handle async flow