testCacheUsage.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Created by Tony on 2017/3/20.
  3. */
  4. var mongoose = require('mongoose');
  5. var test = require('tape');
  6. var cache = require('../../../public/cache/cacheUtil');
  7. var rptUtil = require("../../../modules/reports/util/rpt_util");
  8. //var cfgCacheUtil = require("../../../config/cacheCfg");
  9. test('test cache usage:', function(t) {
  10. cache.setCache("unit_Test_Grp","unit_TestKey","hello my cache!");
  11. var msg = cache.getCache("unit_Test_Grp","unit_TestKey");
  12. console.log(msg);
  13. t.equal(msg, "hello my cache!")
  14. t.end();
  15. });
  16. test('test report default config cache', function(t){
  17. //setReportDefaultCache
  18. rptUtil.setReportDefaultCache();
  19. //cfgCacheUtil.setupDftRptCache();
  20. setTimeout(function(){
  21. var cfg = rptUtil.getReportDefaultCache();
  22. console.log(cfg)
  23. t.equal(cfg.ctrls != null, true);
  24. t.equal(cfg.fonts != null, true);
  25. t.equal(cfg.styles != null, true);
  26. //t.pass('just pass');
  27. t.end();
  28. }, 1000 );
  29. });
  30. test('finish', function (t) {
  31. mongoose.disconnect();
  32. t.pass('closing db connection');
  33. t.end();
  34. });