var helper = require("../../helper");
var Manager = require("../../../src/etl/fact-monitoring-event-etl-manager");
var instanceManager = null;
var should = require("should");
var sqlHelper = require("../../sql-helper");

before("#00. connect db", function (done) {
    Promise.all([helper, sqlHelper])
        .then((result) => {
            var db = result[0];
            var sql = result[1];
            db.getDb().then((db) => {
                instanceManager = new Manager(db, {
                    username: "unit-test"
                }, sql);
                done();
            })
                .catch((e) => {
                    done(e);
                })
        });
});

it("#01. should success when create etl fact-monitoring-event", function (done) {
    instanceManager.run()
        .then((a) => {
            console.log(a);
            done();
        })
        .catch((e) => {
            console.log(e);
            done(e);
        });
});

var data = [{}, {}]

it("#02. should success when transforming data", function (done) {
    instanceManager.transform(data)
        .then(() => {
            done();
        })
        .catch((e) => {
            done(e);
        });
});

it("#03. should error when load empty data", function (done) {
    instanceManager.load({})
        .then(id => {
            done("should error when create with empty data");
        })
        .catch(e => {
            try {                
                done();
            }
            catch (ex) {
                done(ex);
            }
        });
});
@@ -961,16 +961,19 @@
 );%0A%7D);%0A%0A
+// 
 var data
@@ -985,16 +985,19 @@
 %7D, %7B%7D%5D%0A%0A
+// 
 it(%22#02.
@@ -1047,36 +1047,39 @@
 nction (done) %7B%0A
+//
     
+ 
 instanceManager.
@@ -1094,16 +1094,19 @@
 m(data)%0A
+// 
         
@@ -1115,24 +1115,27 @@
 hen(() =%3E %7B%0A
+// 
             
@@ -1134,32 +1134,35 @@
         done();%0A
+// 
         %7D)%0A     
@@ -1148,32 +1148,35 @@
 ;%0A//         %7D)%0A
+// 
         .catch((
@@ -1175,32 +1175,34 @@
 .catch((e) =%3E %7B%0A
+//
             done
@@ -1189,32 +1189,33 @@
 %7B%0A//            
+ 
 done(e);%0A       
@@ -1199,32 +1199,35 @@
        done(e);%0A
+// 
         %7D);%0A%7D);%0A
@@ -1214,32 +1214,35 @@
 %0A//         %7D);%0A
+// 
 %7D);%0A%0Ait(%22#03. sh

update etl