var assert = require('chai').assert;
var PgBoss = require('../src/index');
var helper = require('./testHelper');

describe('connect', function() {

    after(function(finished){
        helper.getDb().executeSql(`DROP SCHEMA IF EXISTS ${helper.config.schema} CASCADE`).then(() => finished());
    });

    it('should fail if connecting to an older schema version', function (finished) {

        helper.getDb().executeSql(`UPDATE ${helper.config.schema}.version SET VERSION = '0.0.0'`)
            .then(() => {
                var boss = new PgBoss(helper.config);

                boss.on('error', function (error) {
                    assert.isNotNull(error);
                    finished();
                });

                boss.connect();
            });
    });

});



@@ -137,24 +137,209 @@
 nction() %7B%0A%0A
+    var boss;%0A%0A    before(function(finished)%7B%0A        helper.start()%0A            .then(dabauce =%3E %7B%0A                boss = dabauce;%0A                finished();%0A            %7D);%0A    %7D);%0A%0A
     after(fu
@@ -348,32 +348,32 @@
 tion(finished)%7B%0A
-
         helper.g
@@ -694,63 +694,8 @@
 %3E %7B%0A
-                var boss = new PgBoss(helper.config);%0A%0A
     
@@ -901,10 +901,8 @@
 );%0A%0A
+
 %7D);%0A
-%0A%0A

fix connect test to start before connect