A small 'live' web site which uses rest-api to represent a pseudo-termial-like interface.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

42 lines
1.1KB

  1. const expect = require('chai').expect
  2. var debug = require('debug');
  3. describe('Tests for app/logging module', function(){
  4. beforeEach(function(){
  5. var debugcb = this.sandbox.spy();
  6. debugcb.namespace = "";
  7. debugcb.enabled = true;
  8. //console.log(require.cache[require.resolve('debug')]);
  9. this.debugcb = debugcb;
  10. this.debug = this.sandbox.stub(require.cache[require.resolve('debug')], 'exports').callsFake(function(ns){
  11. debugcb.namespace = ns;
  12. return debugcb;
  13. });
  14. });
  15. /*it('Create Log instance', function(){
  16. let log = new (require('../app/logging')).Log("test");
  17. expect(this.debug.called).to.eql(true);
  18. });*/
  19. it('Test info()', function(){
  20. let log = new (require('../app/logging')).Log("test");
  21. let msg = "Test Burger";
  22. log.info(msg);
  23. console.log(log.__d === this.debugcb);
  24. console.log(log.__d);
  25. console.log(this.debugcb);
  26. var cb2 = this.debugcb;
  27. cb2.namespace = 'dummy';
  28. console.log(this.debugcb);
  29. console.log(cb2);
  30. console.log(log.__d);
  31. expect(this.debugcb.called).to.eq(true);
  32. //expect(this.debugcb.calledWith("[ INFO ]: " + msg)).to.eql(true);
  33. });
  34. });