/**
 * Created by Tony on 2017/3/20.
 */
var mongoose = require('mongoose');
var test = require('tape');
var cache = require('../../../public/cache/cacheUtil');
var rptUtil = require("../../../modules/reports/util/rpt_util");
//var cfgCacheUtil = require("../../../config/cacheCfg");

test('test cache usage:', function(t) {
    cache.setCache("unit_Test_Grp","unit_TestKey","hello my cache!");
    var msg = cache.getCache("unit_Test_Grp","unit_TestKey");
    console.log(msg);
    t.equal(msg, "hello my cache!")
    t.end();
});

test('test report default config cache', function(t){
    //setReportDefaultCache
    rptUtil.setReportDefaultCache();
    //cfgCacheUtil.setupDftRptCache();
    setTimeout(function(){
        var cfg = rptUtil.getReportDefaultCache();
        console.log(cfg)
        t.equal(cfg.ctrls != null, true);
        t.equal(cfg.fonts != null, true);
        t.equal(cfg.styles != null, true);
        //t.pass('just pass');
        t.end();
    }, 1000 );
});

test('finish', function (t) {
    mongoose.disconnect();
    t.pass('closing db connection');
    t.end();
});