/**
 * Created by Tony on 2017/7/6.
 */

let test = require('tape');
let mongoose = require('mongoose');

let stdgljutil = require("../../public/cache/std_glj_type_util");

test('std glj types test1', function(t){
    stdgljutil.setStdGljTypeCache();
    t.end();
})

test('std glj types test2', function(t){
    setTimeout(function(){
        let cacheObj = stdgljutil.getStdGljTypeCacheObj();
        t.equal(cacheObj != null, true);
        let rgItem = cacheObj.getItemById(301);
        t.equal(rgItem != null, true);
        let tPId = cacheObj.getTopParentIdByItemId(301);
        t.equal(tPId, 3);
        let arr = cacheObj.toArray();
        t.equal(arr.length, 13);
        mongoose.disconnect();
        t.pass('closing db connection');
        t.end();
    }, 500);
})

